├── .gitignore ├── .jscsrc ├── HISTORY.md ├── LICENSE ├── README.md ├── bin └── basis ├── lib ├── api.js ├── cli.js ├── completion │ ├── command.js │ └── completion.sh ├── config │ └── command.js ├── create │ ├── command.js │ ├── index.js │ └── template │ │ ├── app │ │ └── default │ │ │ ├── basis.config │ │ │ ├── index.html │ │ │ ├── package.json │ │ │ ├── src │ │ │ ├── {!!l10n}{=name}.l10n │ │ │ ├── {=name}.js │ │ │ └── {=name} │ │ │ │ ├── service.js │ │ │ │ ├── settings │ │ │ │ └── {!!l10n}l10n.js │ │ │ │ ├── template │ │ │ │ ├── layout.css │ │ │ │ ├── layout.tmpl │ │ │ │ └── {!!l10n}layout.l10n │ │ │ │ ├── type.js │ │ │ │ └── type │ │ │ │ └── type.js │ │ │ └── {!!git}.gitignore │ │ ├── module │ │ ├── default │ │ │ ├── index.js │ │ │ └── template │ │ │ │ ├── view.css │ │ │ │ └── view.tmpl │ │ └── list │ │ │ ├── index.js │ │ │ └── template │ │ │ ├── item.css │ │ │ ├── item.tmpl │ │ │ ├── list.css │ │ │ └── list.tmpl │ │ └── type │ │ └── default │ │ └── {=instanceName}.js └── version.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "requireCurlyBraces": ["do", "try", "catch"], 3 | 4 | "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try"], 5 | "disallowSpaceAfterKeywords": ["catch"], 6 | 7 | "requireParenthesesAroundIIFE": true, 8 | 9 | "disallowSpacesInFunctionExpression": { 10 | "beforeOpeningRoundBrace": true, 11 | "beforeOpeningCurlyBrace": true 12 | }, 13 | 14 | "disallowMultipleVarDecl": true, 15 | "disallowEmptyBlocks": true, 16 | 17 | "requireSpacesInsideObjectBrackets": "all", 18 | "disallowSpacesInsideArrayBrackets": true, 19 | "disallowSpacesInsideParentheses": true, 20 | 21 | "disallowSpaceAfterObjectKeys": true, 22 | 23 | "requireCommaBeforeLineBreak": true, 24 | 25 | "disallowSpaceAfterBinaryOperators": ["!"], 26 | "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "!"], 27 | "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], 28 | 29 | "requireSpacesInConditionalExpression": true, 30 | "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], 31 | "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], 32 | 33 | "requireOperatorBeforeLineBreak": ["/", "*", "&&", "||", "&", "|", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], 34 | 35 | "disallowImplicitTypeConversion": ["string", "binary"], 36 | 37 | "disallowMultipleLineStrings": true, 38 | "validateQuoteMarks": "'", 39 | "requireSemicolons": true, 40 | 41 | "disallowMixedSpacesAndTabs": true, 42 | "disallowTrailingWhitespace": true, 43 | "validateLineBreaks": "LF", 44 | "requireLineFeedAtFileEnd": true, 45 | 46 | "disallowKeywords": ["with", "eval"], 47 | "requireKeywordsOnNewLine": ["else", "while", "for", "do", "return", "switch", "case", "try", "break"], 48 | "disallowKeywordsOnNewLine": ["catch"], 49 | "requireCapitalizedConstructors": true, 50 | 51 | "excludeFiles": [ 52 | "node_modules", 53 | "lib/create/template" 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ## 1.12.2 (September 18, 2017) 2 | 3 | - Bumped `basisjs-tools-build` to `^1.11.3` 4 | - Bumped `basisjs-tools-server` to `^1.0.1` 5 | - Bumped `clap` to `^1.2.2` 6 | 7 | ## 1.12.1 (September 12, 2017) 8 | 9 | - Bumped `basisjs-tools-build` to `^1.11.2` 10 | 11 | ## 1.12.0 (September 6, 2017) 12 | 13 | - Moved `basisjs-tools-server` to a [separate package](https://github.com/basisjs/basisjs-tools-server) 14 | 15 | > Warning! For now `/basisjs-tools/devpanel` doesn't work for `basis.js` (1.11.0 at the moment), since basis's devpanel should migrate to rempl. 16 | 17 | ## 1.11.0 (September 5, 2017) 18 | 19 | - Bumped deps 20 | - `basisjs-tools-ast` to `^1.6.0` 21 | - `basisjs-tools-build` to `^1.11.0` 22 | - `clap` to `~1.2.0` 23 | 24 | ## 1.10.2 (November 7, 2016) 25 | 26 | - Added command details in debug mode to investigate problems with `getBundle` and `getAppProfile` 27 | - Bumped `socket.io` version to work on `node.js` 7+ (@smelukov) 28 | 29 | ## 1.10.1 (August 31, 2016) 30 | 31 | - Fixed issues that break devtool client in `Firefox` and `Edge` 32 | - Devtool client doesn't use `srcdoc` for sandbox anymore since buggy in various scenarios 33 | - Fixed devtool client layout for old `Webkit` browsers 34 | - Tweaked inspect client indicator to fit for small height page 35 | 36 | ## 1.10.0 (August 28, 2016) 37 | 38 | - Implemented remote devtool functionality 39 | - New set of socket commands to communicate with inspecting application 40 | - Special interface to manage inspecting sessions (available at `/basisjs-tools/devtool`) 41 | - Added `--no-gzip` option 42 | - Refactored `http` server 43 | - Moved to its own module 44 | - Implemented symlink functionality 45 | - Implemented middleware functionality 46 | - Converted `rewrite` and `virtualPath` to middlewares 47 | - Refactored `ws` server 48 | - Moved to its own module 49 | - Improved handshake (less notifications and file reads, better warming up and file lists synchronization) 50 | - Renamed `getFileGraph` socket command to `getAppProfile` and changed to return an object (JSON) instead of string 51 | - Implemented `getBundle` socket command that return a build bundle of app 52 | - Extended plugin API: 53 | - Added `addSocketCommand()` method 54 | - Added `addMiddleware()` method 55 | - Added `addSymlink()` method 56 | - Added `error()` method 57 | - Renamed `logMsg()` to `log()` and `logWarn()` to `warn()` 58 | 59 | ## 1.9.1 (July 29, 2016) 60 | 61 | - Fixed `create` command that install `basis.js` in wrong place 62 | 63 | ## 1.9.0 (July 19, 2016) 64 | 65 | - Improved server file watch and synchronization 66 | - On request for file that doesn't exist it adds to await queue and notify client when file creates (for requests with `x-basis-resource` header) 67 | - Add file for await queue on file deletion when file is watching 68 | - Reset resource content (set to `undefined`) on file deletion 69 | - Improved open file in editor 70 | - Use [`open-in-editor`](https://www.npmjs.com/package/open-in-editor) 71 | - Added special url `/basisjs-tools/open-in-editor?file=filename:line:col` 72 | 73 | ## 1.8.0 (March 19, 2016) 74 | 75 | - server: fix start with `--verbose` flag (#18) 76 | - bump dependencies 77 | - `clap` [1.1.0](https://github.com/lahmatiy/clap/releases/tag/v1.1.0) 78 | - `basisjs-tools-config` [1.1.0](https://github.com/basisjs/basisjs-tools-config/releases/tag/v1.1.0) (config in `package.json` support) 79 | - `basisjs-tools-build` [1.4.0](https://github.com/basisjs/basisjs-tools-build/releases/tag/v1.4.0) 80 | 81 | ## 1.7.0 (January 21, 2016) 82 | 83 | - server: basic support for rewrites depends on referer path 84 | - bump dependencies 85 | 86 | ## 1.6.1 (November 24, 2015) 87 | 88 | - fix wrong version `basisjs-tools-build` to `1.1.0` 89 | 90 | ## 1.6.0 (November 24, 2015) 91 | 92 | - server: continue split into modules 93 | - move `sync` server to separate module 94 | - move socket actions (`handshake`, `createFile`, `saveFile` and `readFile`) to separate modules 95 | - server: normalize paths in `watcher` messages 96 | - update `basisjs-tools-build` to `1.2.0` 97 | 98 | ## 1.5.3 (November 10, 2015) 99 | 100 | - fix watcher on Windows 101 | - bump `basisjs-tools-build` version to `1.0.1` 102 | 103 | ## 1.5.2 (November 8, 2015) 104 | 105 | ### server 106 | 107 | - fix: warning on handshake when client sends deleted filenames (after server restart) 108 | - refactor `fsWatcher` and related changes 109 | - avoid locations compute on `html` parse if possible 110 | 111 | ### create 112 | - fix `.gitignore` in app template 113 | 114 | ## 1.5.1 (October 26, 2015) 115 | 116 | - update `socket.io` version (support for `node.js` 4+) 117 | 118 | ## 1.5 (September 19, 2015) 119 | 120 | - move some parts to separate packages: `basisjs-tools-config`, `basisjs-tools-ast` and `basisjs-tools-build` 121 | - don't check for new version of tools for some commands 122 | - refactoring and clean up 123 | - update `jscs` config and code style fixes 124 | 125 | ### extract, build and lint 126 | 127 | Commands moved to package `basisjs-tools-build`. See changes [here](https://github.com/basisjs/basisjs-tools-build/releases/tag/v1.0.0). 128 | 129 | ### server 130 | 131 | - basic plugin support 132 | - drop `preprocess` setting in config in favor of plugins support 133 | - don't apply preprocessors for `basisjs-tools` files 134 | - remove `--no-dot-filename-ignore` option 135 | - remove `--hot-start-cache-by-ext` option 136 | - remove `handler` option (config only) 137 | - new virtual file API 138 | - split into modules 139 | 140 | ### create 141 | 142 | - use `npm` instead of `bower` 143 | - fix: npm spawn on windows 144 | 145 | ## 1.4 (June 14, 2015) 146 | 147 | This version supports for basis.js 1.3 and greater only. For basis.js prior 1.3, please, use `basisjs-tools` 1.3. 148 | 149 | Extract 150 | 151 | - support for basis.js 1.4 152 | - since 1.4 use `basis-config` to init core 153 | - less heuristics, use basis.js core as much as possible (a.e. use `basis.resource.resolveURI` to resolve all paths instead of custom logic) 154 | - improve handler skipping 155 | - consider file read and JSON parse errors as fatal 156 | - FIX: `base`, `file` and `output` path resolving 157 | - rework path resolving: `FileManager` is now work with app files as server path (root is `base` path now) 158 | - move `asset()` and `resource()` relink to `build` 159 | - return promise as command result (resolve async) 160 | - optimize css processing (performance) 161 | - FIX: `file-map` handler when no `basis.l10n` used 162 | - FIX: basis.js commit hash fetch 163 | - FIX: resolving of unknown basis namespace 164 | 165 | - l10n 166 | - improve `l10n` markup token processing (now this feature is completely supported!) 167 | - improve `l10n` dictionary processing 168 | - split `l10n` handlers in `v1` and `v2` versions and related changes 169 | - new `l10n` handler that relink for all links changes 170 | - remove empty `_meta` and `_meta.type` in `v2` dictionaries 171 | - delete unused cultures (that not in culture list) for `v2` dictionaries 172 | - FIX: `l10n` enabled check 173 | 174 | - locations & warnings 175 | - warn about file not found for files that refer for those files 176 | - collect start positions for some tokens on javascript parse 177 | - lint javascript: unused names (definitions) and implicit usage of global names 178 | - add location info to inline scripts and styles 179 | - collect location info for attributes in html 180 | - various fixes and improvements for template warnings 181 | - no warnings for removed template parts 182 | - fix warnings copy on template analyse 183 | - add location for css warnings 184 | - correct warning locations for styles embed in other files 185 | - reduce duplicates in style warnings 186 | - use value parts location map if provided (from basis.js) for correct classes position in attributes 187 | - use styles offset map if provided (from basis.js) for correct class token positions 188 | - add originator and isolate prefix into template and style warnings 189 | - remove class name isolate prefixes in some warnings 190 | - improve warnings output on css info collect 191 | - better warning for non-resolved argument in `dictionary.token()` 192 | - new warning for mismatched paths in `l10n` dictionary type definition 193 | 194 | - template 195 | - use `-js-cut-dev` option instead of `-js-build-mode` to optimize template size 196 | - add support for basis.template declaration `v3` (new bindings format) 197 | - fatal error on missed style files in isolated templates 198 | - fix working with template theme defines 199 | - take in account theme fallbacks 200 | - no redundant templates 201 | - correct style theme distribution 202 | - better support for template inline styles 203 | - fix issue when one template used as several explicit defines 204 | - fix issue when resource reused for explicit define 205 | - move template implicit define injection to build 206 | 207 | Build 208 | 209 | - support for basis.js 1.4 210 | - improve handler skipping 211 | - consider file read and json parse errors as fatal 212 | - fix exit code on errors (important for automation) 213 | - fix `base`, `file` and `output` path resolving 214 | - initially solution to build `Web Worker` scripts 215 | - pretty offset for html injections 216 | - improve style theme choosing on app build startup 217 | - improve logging 218 | - log translated resources 219 | - move summary handler aside 220 | - log inline file in flow 221 | - better output for `css/translate` 222 | - make throw optimisation safe and optional (apply only when `--js-optimize-throws` option is set) 223 | - NEW: option `--same-filenames` 224 | - NEW: option `--tmpl-default-theme` 225 | - FIX: unknown type for `0.css` 226 | - FIX: asset relink for resource files 227 | - FIX: `--css-optimize-names` exception when basis.js is not used 228 | - FIX: `--css-optimize-names` to work correctly with `anim:` bindings 229 | - FIX: CSS corruption on CSS pack, when files contains shared subtrees 230 | - FIX: bug with class name renaming (`--css-optimize-names`) 231 | 232 | Server 233 | 234 | - move proxy and request rewriting to separate module 235 | - fix issue with url resolving when server runs inside `basisjs-tools` 236 | - make case sensitive filename check universal (os-independant) 237 | 238 | Other 239 | 240 | - new command `lint` 241 | - fix broken `config` command 242 | - use `exit` module instead of `process.exit()` 243 | - use hi-res time for timing 244 | - `basis -v` returns proper dev version now 245 | - use `` in default templates (`create` command) 246 | - add some tests 247 | - improve work with CSS AST 248 | - add support for `/deep/` combinator in css parser 249 | - use own translator instead of `csso` translator (performance, less memory consumption) 250 | - new own fast walker 251 | - improve javascript scope processing 252 | - move aside everything not connected with scope from `ast/scope` 253 | - recognise some common global names 254 | - correct process scope for catch clause 255 | 256 | ## 1.3.20 (February 3, 2015) 257 | 258 | - build: hot fix for [broken `htmlparser2` issue](https://github.com/cheeriojs/dom-serializer/issues/19) 259 | 260 | ## 1.3.19 (November 12, 2014) 261 | 262 | - build: fix hash-digest for style files in theme map 263 | - build: add read files content digest to build `` 264 | - build: fetch commit when `basisjs-tools` installed not by version tag 265 | - build: provide real config for `basis.js` 1.4 266 | - build: require `basis.js` only once (in `processBasisFile.js`) 267 | - build: support for local `asset` function and new resolving algorithm for `basis.asset` (for basis.js 1.4) 268 | - build: better error output on `js` compress 269 | - extract: fix issue with template files in the input graph 270 | - extract: fix template comparison (`isolate` issue) 271 | - extract: use basis core to resolve paths for `basis.js` 1.4 272 | - extract: fix `css` info collection for `anim:` bindings 273 | - cli: resolve `basis.config` relative to `process.env.PWD` when possible 274 | - cli and module refactoring 275 | 276 | ## 1.3.18 (October 12, 2014) 277 | 278 | - server: load injected scripts `async` and `defer` 279 | - server: don't notify client about server internal files changes 280 | - server: don't use `basis.js` implicit namespace extensions in client script (avoid warnings in `1.4+`) 281 | - build: exit with code `8` when fatal error (instead of `0`) 282 | - build: remove `--js-resolve-path` option as not working for now 283 | - build: fix `--target output-graph` 284 | - create: fix `app.js` in app template 285 | - change global config name `basis` -> `basisjs-tools` and migration (file path changed as well) 286 | - bump deps 287 | 288 | ## 1.3.17 (July 23, 2014) 289 | 290 | - build & extract: fix `basisjsBaseURI` 291 | - extract: fix l10n dictionary path resolve for `basis.js` prior `1.0` 292 | - cleanup in repo root, remove GPL license 293 | 294 | ## 1.3.16 (July 16, 2014) 295 | 296 | - build: output version and commit (for non-release versions) of `basisjs-tools` and `basis.js` if possible 297 | - build: fix resolving expressions with `__dirname` in `basis.js` modules 298 | - build: robust `--js-pack` handler, if `google-closure-compiler` command is not enabled, use `uglify-js` 299 | - build: show extra info in non-TTY mode (i.e. file output) 300 | - extract: pass correct `sourceOrigin` to `basis.template.makeDeclaration` but not just `true` 301 | - better cli errors output 302 | 303 | ## 1.3.15 (July 10, 2014) 304 | 305 | - build: fix build regression for `basis.js` prior `1.3.0` (added in `1.3.12`) 306 | - build: fix build for `basis.js` 1.3.0 with modules that create a sandbox (for example `basis.devpanel`) 307 | 308 | ## 1.3.14 (July 8, 2014) 309 | 310 | - build & extract: set up env for `basis.js` (uses since `1.3.0`) 311 | - server: show error message instead of exception when `socket.io` lib is not defined 312 | - server: unify client/server communication on sync init (`ready`/`knownFiles` -> `handshake`) 313 | - server: new option `--inspect` to include inspecting script 314 | - server: fix internal redirects when no host in destination 315 | 316 | ## 1.3.13 (July 1, 2014) 317 | 318 | - server: fix issue with `fileSync.js` on Mac OS 319 | 320 | ## 1.3.12 (July 1, 2014) 321 | 322 | - server: fix `socket.io` issue when using with `require.js` using 323 | - server: inject `socket.io` client in `fileSync.js` 324 | - add support for `basis.js` 1.3.0 config in `extract` and `build` 325 | 326 | ## 1.3.11 (June 26, 2014) 327 | 328 | - update dependancies versions 329 | - implement global config storage and `config` command 330 | - create: update templates 331 | - create: use create.templates option in config to specify optional paths for templates 332 | - server: tweak init output 333 | - server: don't load socket.io through XHR, but using ` 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/create/template/app/default/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{=name}", 3 | "title": "{=appTitle}", 4 | "version": "1.0.0", 5 | "private": true 6 | } 7 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{!!l10n}{=name}.l10n: -------------------------------------------------------------------------------- 1 | { 2 | "en-US": { 3 | "title": "{=appTitle}" 4 | }, 5 | "ru-RU": { 6 | "title": "{=appTitle}" 7 | } 8 | } -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}.js: -------------------------------------------------------------------------------- 1 | var Node = require('basis.ui').Node; 2 | {!!l10n}var dict = require('basis.l10n').dictionary(__filename); 3 | {!!l10n}require('app.settings.l10n'); 4 | 5 | module.exports = require('basis.app').create({ 6 | { !l10n}{!!appTitle} title: '{=appTitle}', 7 | { !l10n}{!!appTitle} 8 | {!!l10n} title: dict.token('title'), 9 | {!!l10n} 10 | init: function(){ 11 | return new Node({ 12 | template: resource('./{=name}/template/layout.tmpl'), 13 | binding: { 14 | //moduleName: resource('./module/moduleName/index.js') 15 | } 16 | }); 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/service.js: -------------------------------------------------------------------------------- 1 | var Service = require('basis.net.service').Service; 2 | 3 | var defaultService = new Service({ 4 | // transportClass: basis.net.ajax.Transport.subclass({ 5 | // init: function(){ 6 | // this.url = '/api/' + this.controller; 7 | // basis.net.ajax.Transport.prototype.init.call(this); 8 | // } 9 | // }) 10 | }); 11 | 12 | module.exports = defaultService; 13 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/settings/{!!l10n}l10n.js: -------------------------------------------------------------------------------- 1 | var l10n = require('basis.l10n'); 2 | 3 | l10n.setCultureList('en-US ru-RU'); 4 | l10n.setCulture('en-US'); 5 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/template/layout.css: -------------------------------------------------------------------------------- 1 | HTML, 2 | BODY 3 | { 4 | height: 100%; 5 | padding: 0; 6 | margin: 0; 7 | 8 | background: white; 9 | color: black; 10 | font-size: small; 11 | } 12 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/template/layout.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | { !l10n}

Congrat, your app is working!

6 | {!!l10n}

{l10n:greeting}

7 |
8 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/template/{!!l10n}layout.l10n: -------------------------------------------------------------------------------- 1 | { 2 | "en-US": { 3 | "greeting": "Congrat, your app is working!" 4 | }, 5 | "ru-RU": { 6 | "greeting": "Поздравляем, ваше приложение работает!" 7 | } 8 | } -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/type.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // TypeName: require('./type/typeName.js') 3 | }; 4 | 5 | require('basis.entity').validate(); 6 | -------------------------------------------------------------------------------- /lib/create/template/app/default/src/{=name}/type/type.js: -------------------------------------------------------------------------------- 1 | var entity = require('basis.entity'); 2 | var service = require('{=name}.service'); 3 | 4 | // 5 | // main part 6 | // 7 | 8 | var TypeName = entity.createType('TypeName', { 9 | id: entity.IntId, 10 | title: String 11 | }); 12 | 13 | /* 14 | TypeName.extendClass({ 15 | syncAction: service.createAction({ 16 | url: '/api/...', 17 | success: function(data){ 18 | this.update(TypeName.reader(data)); 19 | } 20 | }) 21 | }); 22 | 23 | TypeName.all.setSyncAction(service.createAction({ 24 | url: '/api/...', 25 | success: function(data){ 26 | this.sync(basis.array(data).map(TypeName.reader)); 27 | } 28 | })); 29 | */ 30 | 31 | // 32 | // export names 33 | // 34 | 35 | module.exports = TypeName; 36 | -------------------------------------------------------------------------------- /lib/create/template/app/default/{!!git}.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | build/ 3 | -------------------------------------------------------------------------------- /lib/create/template/module/default/index.js: -------------------------------------------------------------------------------- 1 | var Node = require('basis.ui').Node; 2 | 3 | module.exports = new Node({ 4 | template: resource('./template/view.tmpl'), 5 | binding: { 6 | }, 7 | action: { 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /lib/create/template/module/default/template/view.css: -------------------------------------------------------------------------------- 1 | .{=name} 2 | { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /lib/create/template/module/default/template/view.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | [{=filename}] 6 |
7 | -------------------------------------------------------------------------------- /lib/create/template/module/list/index.js: -------------------------------------------------------------------------------- 1 | var Node = require('basis.ui').Node; 2 | {!!type}var types = require('{=appName}.type'); 3 | 4 | module.exports = new Node({ 5 | {!!type} dataSource: types.{=type}.all, 6 | {!!type} active: true, 7 | {!!type} 8 | template: resource('./template/list.tmpl'), 9 | 10 | childClass: { 11 | template: resource('./template/item.tmpl'), 12 | binding: { 13 | title: 'data:' 14 | } 15 | }{!type}, 16 | { !type} 17 | { !type} childNodes: basis.array.create(5, function(idx){ 18 | { !type} return { 19 | { !type} data: { 20 | { !type} title: 'item ' + idx 21 | { !type} } 22 | { !type} } 23 | { !type} }) 24 | {!!type} 25 | }); 26 | -------------------------------------------------------------------------------- /lib/create/template/module/list/template/item.css: -------------------------------------------------------------------------------- 1 | .item 2 | { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /lib/create/template/module/list/template/item.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
  • 5 | {title} 6 |
  • 7 | -------------------------------------------------------------------------------- /lib/create/template/module/list/template/list.css: -------------------------------------------------------------------------------- 1 | .list 2 | { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /lib/create/template/module/list/template/list.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | {=name} list: 6 | 7 |
    8 | -------------------------------------------------------------------------------- /lib/create/template/type/default/{=instanceName}.js: -------------------------------------------------------------------------------- 1 | var entity = require('basis.entity'); 2 | var service = require('{=appName}.service'); 3 | 4 | // 5 | // main part 6 | // 7 | 8 | var {=name} = entity.createType('{=name}', { 9 | id: entity.IntId, 10 | title: String 11 | }); 12 | 13 | /* 14 | {=name}.extendClass({ 15 | syncAction: service.createAction({ 16 | url: '/api/...', 17 | success: function(data){ 18 | this.update({=name}.reader(data)); 19 | } 20 | }) 21 | }); 22 | 23 | {=name}.all.setSyncAction(service.createAction({ 24 | url: '/api/...', 25 | success: function(data){ 26 | this.sync(basis.array(data).map({=name}.reader)); 27 | } 28 | })); 29 | */ 30 | 31 | // 32 | // export names 33 | // 34 | 35 | module.exports = {=name}; 36 | -------------------------------------------------------------------------------- /lib/version.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | /** 4 | * Trying get a commit hash for specified folder (supposed a git repo or bower library). 5 | * @param {string} dir Location for lookup 6 | * @param {number=} len Max length of hash 7 | */ 8 | function fetchCommit(dir, len){ 9 | if (!len) 10 | len = 10; 11 | 12 | try { 13 | var gitPath = dir + '/.git/'; 14 | var gitRef = fs.readFileSync(gitPath + 'HEAD', 'utf-8'); 15 | if (gitRef) 16 | { 17 | var ref = gitRef.match(/(?:^|\n)ref:\s*([^\n]+)/); 18 | if (ref) 19 | return fs.readFileSync(gitPath + ref[1], 'utf-8').substr(0, len); 20 | } 21 | } catch(e) {} 22 | 23 | try { 24 | return require(dir + '/.bower.json')._resolution.commit.substr(0, len); 25 | } catch(e){} 26 | } 27 | 28 | /** 29 | * Returns proper tools version. If dev version it adds to version commit hash. 30 | * @param {boolean} tag Return version as tag, i.e. `x.x.x-dev-hash`. Otherwise returns `basisjs-tools@x.x.x (hash)`. 31 | * @return {string} Current tools version. 32 | */ 33 | function getToolsId(tag){ 34 | var toolsPkg = require('../package.json'); 35 | var toolsId = toolsPkg._id; 36 | var commit; 37 | 38 | if (!toolsId) 39 | { 40 | commit = fetchCommit(__dirname + '/..'); 41 | toolsId = (!tag ? toolsPkg.name + '@' : '') + toolsPkg.version; 42 | } 43 | else 44 | { 45 | if (tag) 46 | toolsId = toolsId.replace(/^.+\@/, ''); 47 | 48 | if (toolsPkg._resolved) 49 | { 50 | var m = toolsPkg._resolved.match(/#(.{1,10})/); 51 | if (m) 52 | commit = m[1]; 53 | } 54 | } 55 | 56 | if (commit) 57 | toolsId += tag 58 | ? '-dev-' + commit 59 | : ' (' + commit + ')'; 60 | 61 | return toolsId; 62 | } 63 | 64 | module.exports = { 65 | fetchCommit: fetchCommit, 66 | getToolsId: getToolsId 67 | }; 68 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "basisjs-tools", 3 | "title": "Basis.js developer tools", 4 | "version": "1.12.2", 5 | "homepage": "https://github.com/basisjs/basisjs-tools", 6 | "description": "Developer tools for basis.js framework", 7 | "author": "Roman Dvornov ", 8 | "license": "MIT", 9 | "contributors": [ 10 | "Roman Dvornov ", 11 | "Vladimir Ratsev " 12 | ], 13 | "repository": "basisjs/basisjs-tools", 14 | "main": "./lib/api", 15 | "bin": { 16 | "basis": "./bin/basis" 17 | }, 18 | "preferGlobal": true, 19 | "engines": { 20 | "node": ">=0.10.0" 21 | }, 22 | "dependencies": { 23 | "basisjs-tools-config": "^1.1.0", 24 | "basisjs-tools-ast": "^1.6.0", 25 | "basisjs-tools-build": "^1.11.3", 26 | "basisjs-tools-server": "^1.0.1", 27 | "clap": "~1.2.3", 28 | "update-notifier": "0.6.3", 29 | "chalk": "~1.1.3", 30 | "win-spawn": "2.0.0", 31 | "exit": "0.1.2" 32 | }, 33 | "devDependencies": {}, 34 | "scripts": {}, 35 | "eslintConfig": { 36 | "env": { 37 | "node": true, 38 | "mocha": true, 39 | "es6": true 40 | }, 41 | "rules": { 42 | "no-undef": 2, 43 | "no-unused-vars": [ 44 | 2, 45 | { 46 | "vars": "all", 47 | "args": "after-used" 48 | } 49 | ] 50 | } 51 | }, 52 | "files": [ 53 | "bin", 54 | "lib", 55 | "HISTORY.md", 56 | "LICENSE", 57 | "README.md" 58 | ] 59 | } 60 | --------------------------------------------------------------------------------