angular-cn/Brocfile.js
Alex Eagle d6003ee0ab chore(build): Add traceur transpiler for broccoli.
This exactly reproduces the output tree from one of the gulp tasks, which is now removed.
Next step is to migrate another sibling task to broccoli.
2015-04-07 16:38:02 -07:00

39 lines
1.1 KiB
JavaScript

/**
* Build pipeline for Angular2.
* First time setup:
* $ npm install --global broccoli-cli
*/
var merge = require('merge');
var TraceurCompiler = require('./tools/broccoli/traceur');
var Funnel = require('broccoli-funnel');
var stew = require('broccoli-stew');
var _COMPILER_CONFIG_JS_DEFAULT = {
sourceMaps: true,
annotations: true, // parse annotations
types: true, // parse types
script: false, // parse as a module
memberVariables: true, // parse class fields
modules: 'instantiate'
};
var modulesTree = new Funnel('modules', {include: ['**/**'], destDir: '/'});
var transpiledTree = new TraceurCompiler(modulesTree, merge(true, _COMPILER_CONFIG_JS_DEFAULT, {
typeAssertionModule: 'rtts_assert/rtts_assert',
typeAssertions: true,
outputLanguage: 'es6'
}));
transpiledTree = stew.rename(transpiledTree, function(relativePath) {
return relativePath.replace(/\.(js|es6)\.map$/, '.map')
.replace(/\.js$/, '.es6');
});
transpiledTree = stew.mv(transpiledTree, 'js/dev/es6')
//transpiledTree = stew.log(transpiledTree);
module.exports = transpiledTree;