Skip to content

Instantly share code, notes, and snippets.

@jkuri
Created January 10, 2016 23:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkuri/d5a3af8cfa1996c8cf6a to your computer and use it in GitHub Desktop.
Save jkuri/d5a3af8cfa1996c8cf6a to your computer and use it in GitHub Desktop.
var pkg = require('./package.json');
var path = require('path');
var Builder = require('systemjs-builder');
var name = pkg.name;
var builder = new Builder();
var config = {
baseURL: '.',
transpiler: 'typescript',
typescriptOptions: {
module: 'cjs'
},
map: {
typescript: './node_modules/typescript/lib/typescript.js',
angular2: path.resolve('node_modules/angular2'),
rxjs: path.resolve('node_modules/rxjs')
},
paths: {
'*': '*.js'
},
meta: {
'node_modules/angular2/*': { build: false },
'node_modules/rxjs/*': { build: false }
},
};
builder.config(config);
builder
.bundle(name, path.resolve(__dirname, 'bundles/', name + '.js'))
.then(function() {
var prodBuilder = new Builder();
prodBuilder.config(config);
prodBuilder
.bundle(name, path.resolve(__dirname, 'bundles/', name + '.min.js'), {
minify: true, sourceMaps: true
})
.then(function() {
console.log('Build complete.');
});
})
.catch(function(err) {
console.log('Error', err);
});
@NathanWalker
Copy link

Should this script become an npm package? That way all ng2 lib authors could declare as dependency and make it a part of their build scripts when publishing?

@jkuri
Copy link
Author

jkuri commented Feb 4, 2016

I think this is just a temporary solution as of TypeScript 1.8 this script won't be needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment