From 79e62689c0596ecadc932b9c687135b7498d328e Mon Sep 17 00:00:00 2001 From: Thorsten Hans Date: Mon, 6 Jun 2016 20:06:49 +0200 Subject: [PATCH] required changes to gulp to get ng2 rc1 build up and running --- gulp.config.js | 32 +++++++++++++++++--------------- gulpTasks/web.js | 21 ++++++++++++++------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/gulp.config.js b/gulp.config.js index ccffccf..1683264 100644 --- a/gulp.config.js +++ b/gulp.config.js @@ -6,13 +6,14 @@ module.exports = { folder: './src/BoardZ/', files: { injectables: [ - './dist/www/scripts/es6-shim.min.js', - './dist/www/scripts/shims_for_IE.js', './dist/www/scripts/vendor.min.js', - './dist/www/scripts/angular2.min.js', + './dist/www/scripts/system.min.js', './dist/www/scripts/system.setup.js', './dist/www/css/vendor.min.css', - './dist/www/css/app.css' + './dist/www/css/app.css', + './dist/www/scripts/shim.min.js', + './dist/www/scripts/zone.js', + './dist/www/scripts/reflect.js' ], electronFiles: './electron/**/*.*', cordovaFiles: './cordova/', @@ -67,23 +68,24 @@ module.exports = { './src/BoardZ/vendor/bootstrap/js/bootstrap.js', './src/BoardZ/vendor/fastclick/fastclick.js', './src/BoardZ/vendor/admin-lte/js/app.js', - './src/BoardZ/vendor/leaflet-js/leaflet-src.js'], - angular2: [ - './node_modules/systemjs/dist/system-polyfills.js', - './node_modules/angular2/bundles/angular2-polyfills.js', - './node_modules/systemjs/dist/system.src.js', - './node_modules/rxjs/bundles/Rx.js', - './node_modules/angular2/bundles/angular2.dev.js', - './node_modules/angular2/bundles/http.dev.js', - './node_modules/angular2/bundles/router.dev.js' - ] + './src/BoardZ/vendor/leaflet-js/leaflet-src.js' + + ], + angular2rc1deps: [ + './node_modules/core-js/client/shim.min.js', + './node_modules/zone.js/dist/zone.js', + './node_modules/reflect-metadata/reflect.js' + ], + angular2: './node_modules/@angular/**/*', + rxjs: './node_modules/rxjs/**/*', + systemJs: './node_modules/systemjs/dist/system.src.js' } }, ts: { config: './tsconfig.json' }, targets: { - angular2MinJs: 'angular2.min.js', + systemMinJs: 'system.min.js', vendorMinJs: 'vendor.min.js', vendorMinCss: 'vendor.min.css', buildFolder: './dist/www', diff --git a/gulpTasks/web.js b/gulpTasks/web.js index 4cb5510..a2dd829 100644 --- a/gulpTasks/web.js +++ b/gulpTasks/web.js @@ -16,6 +16,7 @@ ts = require('gulp-typescript'), tsConfig = ts.createProject(config.ts.config), sourcemaps = require('gulp-sourcemaps'), + rename = require('gulp-rename'), inject = require('gulp-inject'), uglify = require('gulp-uglify'), watch = require('gulp-watch'), @@ -32,6 +33,8 @@ gulp.task('[private-web]:bundle-vendor-scripts', function () { var builder = new Builder(); + gulp.src(config.source.files.angular2rc1deps) + .pipe(gulp.dest(path.join(config.targets.buildFolder, 'scripts'))); return builder.loadConfig(config.systemJsConfig) .then(function () { @@ -48,9 +51,12 @@ gulp.task('[private-web]:copy-angular2-scripts', function () { return gulp.src(config.source.files.angular2) - .pipe(concat(config.targets.angular2MinJs)) - //.pipe(uglify()) - .pipe(gulp.dest(path.join(config.targets.buildFolder, 'scripts/'))); + .pipe(gulp.dest(path.join(config.targets.buildFolder, '@angular'))); + }); + + gulp.task('[private-web]:copy-rxjs-scripts', function () { + return gulp.src(config.source.files.rxjs) + .pipe(gulp.dest(path.join(config.targets.buildFolder, 'rxjs'))); }); gulp.task('[private-web]:copy-system-setup-script', function () { @@ -65,10 +71,10 @@ }); - gulp.task('[private-web]:copy-shim', function () { - // es6shim cant be bundled with angular-polyfills see https://github.com/angular/angular/issues/6706 - return gulp.src(config.source.files.shim) + gulp.task('[private-web]:copy-system', function () { + return gulp.src(config.source.files.systemJs) .pipe(uglify()) + .pipe(rename(config.targets.systemMinJs)) .pipe(gulp.dest(path.join(config.targets.buildFolder, 'scripts/'))) }); @@ -124,9 +130,10 @@ [ '[private-web]:bundle-vendor-scripts', '[private-web]:copy-angular2-scripts', + '[private-web]:copy-rxjs-scripts', '[private-web]:copy-system-setup-script', '[private-web]:copy-cordova-script', - '[private-web]:copy-shim', + '[private-web]:copy-system', '[private-web]:build-app-scripts', '[private-web]:vendor-css', '[private-web]:copy-fonts',