From 85b8a1537435258e2f74f4dfe92782239fc6a376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Fri, 12 Jun 2015 10:30:08 -0700 Subject: [PATCH] chore(build): add a task to watch and render examples and e2e tests for production You can now run `gulp serve.e2e.prod` to instantiate a task that watches and compiles example and module files into the prod directory in dist and then allows the code to be run via protractor. Closes #2369 --- gulpfile.js | 58 +++++++++++++++++++++++--------------- protractor-js-prod.conf.js | 3 ++ 2 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 protractor-js-prod.conf.js diff --git a/gulpfile.js b/gulpfile.js index 806a87fb69..872fafcfaa 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -240,36 +240,47 @@ gulp.task('build/checkCircularDependencies', function (done) { done(); }); +function jsServeDev() { + return jsserve(gulp, gulpPlugins, { + path: CONFIG.dest.js.dev.es5, + port: 8000 + })(); +} + +function jsServeProd() { + return jsserve(gulp, gulpPlugins, { + path: CONFIG.dest.js.prod.es5, + port: 8001 + })(); +} + +function jsServeDartJs() { + return jsserve(gulp, gulpPlugins, { + path: CONFIG.dest.js.dart2js, + port: 8002 + })(); +} + // ------------------ // web servers gulp.task('serve.js.dev', ['build.js.dev'], function(neverDone) { watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev'); - - jsserve(gulp, gulpPlugins, { - path: CONFIG.dest.js.dev.es5, - port: 8000 - })(); + jsServeDev(); }); +gulp.task('serve.js.prod', jsServeProd); + gulp.task('serve.e2e.dev', ['build.js.dev', 'build.js.cjs', 'build.css.material'], function(neverDone) { - watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev'); - watch('modules/**', { ignoreInitial: true }, '!build.js.cjs'); - - jsserve(gulp, gulpPlugins, { - path: CONFIG.dest.js.dev.es5, - port: 8000 - })(); + watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.dev', '!build.js.cjs']); + jsServeDev(); }); -gulp.task('serve.js.prod', jsserve(gulp, gulpPlugins, { - path: CONFIG.dest.js.prod.es5, - port: 8001 -})); +gulp.task('serve.e2e.prod', ['build.js.prod', 'build.js.cjs', 'build.css.material'], function(neverDone) { + watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.prod', '!build.js.cjs']); + jsServeProd(); +}); -gulp.task('serve.js.dart2js', jsserve(gulp, gulpPlugins, { - path: CONFIG.dest.js.dart2js, - port: 8002 -})); +gulp.task('serve.js.dart2js', jsServeDartJs); gulp.task('serve/examples.dart', pubserve(gulp, gulpPlugins, { command: DART_SDK.PUB, @@ -668,6 +679,9 @@ gulp.task('!broccoli.js.dev', function() { return angularBuilder.rebuildBrowserDevTree(); }); +gulp.task('!broccoli.js.prod', function() { + return angularBuilder.rebuildBrowserProdTree(); +}); gulp.task('build.js.dev', ['build/clean.js'], function(done) { runSequence( @@ -678,8 +692,8 @@ gulp.task('build.js.dev', ['build/clean.js'], function(done) { ); }); -gulp.task('build.js.prod', ['build.tools'], function() { - return angularBuilder.rebuildBrowserProdTree(); +gulp.task('build.js.prod', ['build.tools'], function(done) { + runSequence('!broccoli.js.prod', sequenceComplete(done)); }); diff --git a/protractor-js-prod.conf.js b/protractor-js-prod.conf.js new file mode 100644 index 0000000000..0ec762bb45 --- /dev/null +++ b/protractor-js-prod.conf.js @@ -0,0 +1,3 @@ +var data = module.exports = require('./protractor-shared.js'); +var config = data.config; +config.baseUrl = 'http://localhost:8001/';