feat(gulp): adds System.register bundle task.
This commit is contained in:
parent
86dc3e5b07
commit
c0b04ca0bc
|
@ -26,4 +26,7 @@ pubspec.lock
|
|||
# Don't check in secret files
|
||||
*secret.js
|
||||
|
||||
# Ignore npm debug log
|
||||
npm-debug.log
|
||||
|
||||
/docs/bower_components/
|
||||
|
|
70
gulpfile.js
70
gulpfile.js
|
@ -29,9 +29,13 @@ var transformCJSTests = require('./tools/build/transformCJSTests');
|
|||
var tsc = require('gulp-typescript');
|
||||
var ts2dart = require('gulp-ts2dart');
|
||||
var util = require('./tools/build/util');
|
||||
var bundler = require('./tools/build/bundle');
|
||||
var concat = require('gulp-concat');
|
||||
|
||||
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
|
||||
|
||||
var DART_SDK = require('./tools/build/dartdetect')(gulp);
|
||||
|
||||
// -----------------------
|
||||
// configuration
|
||||
|
||||
|
@ -787,7 +791,71 @@ gulp.task('build.js.cjs', function(done) {
|
|||
);
|
||||
});
|
||||
|
||||
gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs']);
|
||||
var bundleConfig = {
|
||||
paths: {
|
||||
"*": "dist/js/prod/es6/*.es6",
|
||||
"rx/*": "node_modules/rx/*.js"
|
||||
}
|
||||
};
|
||||
|
||||
// production build
|
||||
gulp.task('bundle.js.prod', ['build.js.prod'], function() {
|
||||
return bundler.bundle(
|
||||
bundleConfig,
|
||||
'angular2/angular2',
|
||||
'./dist/build/angular2.js',
|
||||
{
|
||||
sourceMaps: true
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('bundle.js.prod.deps', ['bundle.js.prod'], function() {
|
||||
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.js'])
|
||||
.pipe(concat('angular2.js'))
|
||||
.pipe(gulp.dest('dist/bundle'));
|
||||
});
|
||||
|
||||
// minified production build
|
||||
// TODO: minify zone.js?
|
||||
gulp.task('bundle.js.min', ['build.js.prod'], function() {
|
||||
return bundler.bundle(
|
||||
bundleConfig,
|
||||
'angular2/angular2',
|
||||
'./dist/build/angular2.min.js',
|
||||
{
|
||||
sourceMaps: true,
|
||||
minify: true
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('bundle.js.min.deps', ['bundle.js.min'], function() {
|
||||
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.min.js'])
|
||||
.pipe(concat('angular2.min.js'))
|
||||
.pipe(gulp.dest('dist/bundle'));
|
||||
});
|
||||
|
||||
// development build
|
||||
gulp.task('bundle.js.dev', ['build.js.dev'], function() {
|
||||
return bundler.bundle(
|
||||
merge(true, bundleConfig, {
|
||||
"*": "dist/js/dev/es6/*.es6"
|
||||
}),
|
||||
'angular2/angular2',
|
||||
'./dist/build/angular2.dev.js',
|
||||
{
|
||||
sourceMaps: true
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() {
|
||||
return gulp.src(['node_modules/zone.js/zone.js', 'dist/build/angular2.dev.js'])
|
||||
.pipe(concat('angular2.dev.js'))
|
||||
.pipe(gulp.dest('dist/bundle'));
|
||||
});
|
||||
|
||||
gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundle.js.deps']);
|
||||
|
||||
gulp.task('bundle.js.deps', ['bundle.js.prod.deps', 'bundle.js.dev.deps', 'bundle.js.min.deps']);
|
||||
|
||||
gulp.task('clean', ['build/clean.js', 'build/clean.dart', 'build/clean.docs']);
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
"glob": "^4.0.6",
|
||||
"gulp": "^3.8.8",
|
||||
"gulp-changed": "^1.0.0",
|
||||
"gulp-concat": "^2.5.2",
|
||||
"gulp-connect": "~1.0.5",
|
||||
"gulp-jasmine": "^1.0.1",
|
||||
"gulp-load-plugins": "^0.7.1",
|
||||
|
@ -76,6 +77,7 @@
|
|||
"run-sequence": "^0.3.6",
|
||||
"source-map": "^0.3.0",
|
||||
"sprintf-js": "1.0.*",
|
||||
"systemjs-builder": "^0.10.3",
|
||||
"temp": "^0.8.1",
|
||||
"ternary-stream": "^1.2.3",
|
||||
"through2": "^0.6.1",
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConfig){
|
||||
// loading it earlier interfers with custom traceur.
|
||||
var Builder = require('systemjs-builder');
|
||||
var builder = new Builder();
|
||||
builder.config(buildConfig);
|
||||
return builder.build(moduleName, outputFile, outputConfig);
|
||||
}
|
Loading…
Reference in New Issue