From 24b4088bfbe00e44a6a77e200d14fb2e8a40aec3 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Wed, 16 Dec 2015 16:17:27 -0600 Subject: [PATCH] chore(bundle): bring back system bundle UMD bundle is great, but mainly meant for ES5/ngUpgrade apps, while the system bundle is for plunkers and in our case, tests. --- gulpfile.js | 31 +++++++++++++++++++++++++++++-- package.json | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b6664a7e29..deff75c867 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -25,8 +25,7 @@ var tscOptions = { experimentalDecorators: true, target: "es5", module: "commonjs", - declaration: true, - outDir: "dist" + declaration: true } var tscOptionsNoTypeCheck = { @@ -37,6 +36,13 @@ var tscOptionsNoTypeCheck = { isolatedModules: true } +var tscOptionsEs6 = { + emitDecoratorMetadata: true, + experimentalDecorators: true, + target: 'ES6', + isolatedModules: true +} + var tscReporter = { error: function (error) { // TODO @@ -45,6 +51,17 @@ var tscReporter = { } }; +// We use Babel to easily create named System.register modules +// See: https://github.com/Microsoft/TypeScript/issues/4801 +// and https://github.com/ivogabe/gulp-typescript/issues/211 +var babelOptions = { + modules: 'system', + moduleIds: true, + getModuleId: function(name) { + return 'ionic/' + name; + } +} + gulp.task('build', function(done) { runSequence( 'copy.web-animations', @@ -149,6 +166,16 @@ gulp.task('transpile.typecheck', function(){ .pipe(gulp.dest('dist')); }) +gulp.task('bundle.system', function(){ + var babel = require('gulp-babel'); + var concat = require('gulp-concat'); + + return tsCompile(tscOptionsEs6, 'babel') + .pipe(babel(babelOptions)) + .pipe(concat('ionic.system.js')) + .pipe(gulp.dest('dist/bundles')) +}) + gulp.task('transpile', ['transpile.no-typecheck']); gulp.task('bundle', ['transpile'], function(done){ diff --git a/package.json b/package.json index 0ad1dabadd..0ba4bbc17c 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "glob": "^5.0.14", "gulp": "~3.8.10", "gulp-autoprefixer": "^2.3.0", + "gulp-babel": "^5.3.0", "gulp-cached": "^1.1.0", "gulp-concat": "~2.5.0", "gulp-connect": "^2.2.0",