- (DONE) Create a build system for TypeScript project, that successfully handles following tasks:
- Supports different build types:
- Pure AMD build for direct usage in RequireJS project (front-end dev mode)
- Pure CommonJS build for NodeJS (with bundled source map support)
- Standalone build for browser environment
- Compiled as single-file
- Compressed and/or minified
- Should work without RequireJS, but should be still compatible with AMD/RequireJS environment
- Compiles TypeScript preserving source map information for each original TS file no matter which buld type is used
- Reduce TS compilator code duplication (like
...args
notation support orextend
function, etc.)
- Supports different build types:
- (InProgress) Create test framework foundation
- Mocha test framework (Chai assertion engine)
- Karma and console test runners
- Istanbul code coverage, which is obtained for original TS files (if possible)
- (TBD) Performance-efficient watchers
- (TBD) Browser auto-reload
$ npm install
$ bower install
If you don't have Grunt or Bower do the following:
$ npm install -g bower grunt-cli
Usage:
$ grunt [type]
- empty type - concurrently build everything
- amd - Create AMD build for RequireJS
- node - Create CommonJS build for NodeJS
- standalone - Create standalone build for browser
- watch[:type] - watch, where type can be:
- all - concurrently build everything
- amd|node|standalone - separately build only specific type of build
To get test results or coverage run:
$ grunt test
$ grunt coverage
After build open ./web/*.html
files in browser. Type RCSDK.modelInstance.foo()
in standalone mode (files
standalone[-min].html
) or RCSDK.amd.modelInstance.foo()
in RequireJS mode (file requirejs.html
) to get an error.
Also type node node
in terminal. Script will immediately die with an error, take a close look on stack trace, it
should contain references to original TypeScript files.
- All build paths are located in
package.json
- Coverage understanding tips:
- gotwarlost/istanbul#59
if (b.hasOwnProperty(p)) d[p] = b[p];
- there were no statics defined in classargs[_i] = arguments[_i + 0];
-...args
was not used