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
This commit is contained in:
Matias Niemelä 2015-06-12 10:30:08 -07:00
parent 920982c4e8
commit 85b8a15374
2 changed files with 39 additions and 22 deletions

View File

@ -240,36 +240,47 @@ gulp.task('build/checkCircularDependencies', function (done) {
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 // web servers
gulp.task('serve.js.dev', ['build.js.dev'], function(neverDone) { gulp.task('serve.js.dev', ['build.js.dev'], function(neverDone) {
watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev'); watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev');
jsServeDev();
jsserve(gulp, gulpPlugins, {
path: CONFIG.dest.js.dev.es5,
port: 8000
})();
}); });
gulp.task('serve.js.prod', jsServeProd);
gulp.task('serve.e2e.dev', ['build.js.dev', 'build.js.cjs', 'build.css.material'], function(neverDone) { 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 }, ['!broccoli.js.dev', '!build.js.cjs']);
watch('modules/**', { ignoreInitial: true }, '!build.js.cjs'); jsServeDev();
jsserve(gulp, gulpPlugins, {
path: CONFIG.dest.js.dev.es5,
port: 8000
})();
}); });
gulp.task('serve.js.prod', jsserve(gulp, gulpPlugins, { gulp.task('serve.e2e.prod', ['build.js.prod', 'build.js.cjs', 'build.css.material'], function(neverDone) {
path: CONFIG.dest.js.prod.es5, watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.prod', '!build.js.cjs']);
port: 8001 jsServeProd();
})); });
gulp.task('serve.js.dart2js', jsserve(gulp, gulpPlugins, { gulp.task('serve.js.dart2js', jsServeDartJs);
path: CONFIG.dest.js.dart2js,
port: 8002
}));
gulp.task('serve/examples.dart', pubserve(gulp, gulpPlugins, { gulp.task('serve/examples.dart', pubserve(gulp, gulpPlugins, {
command: DART_SDK.PUB, command: DART_SDK.PUB,
@ -668,6 +679,9 @@ gulp.task('!broccoli.js.dev', function() {
return angularBuilder.rebuildBrowserDevTree(); return angularBuilder.rebuildBrowserDevTree();
}); });
gulp.task('!broccoli.js.prod', function() {
return angularBuilder.rebuildBrowserProdTree();
});
gulp.task('build.js.dev', ['build/clean.js'], function(done) { gulp.task('build.js.dev', ['build/clean.js'], function(done) {
runSequence( runSequence(
@ -678,8 +692,8 @@ gulp.task('build.js.dev', ['build/clean.js'], function(done) {
); );
}); });
gulp.task('build.js.prod', ['build.tools'], function() { gulp.task('build.js.prod', ['build.tools'], function(done) {
return angularBuilder.rebuildBrowserProdTree(); runSequence('!broccoli.js.prod', sequenceComplete(done));
}); });

View File

@ -0,0 +1,3 @@
var data = module.exports = require('./protractor-shared.js');
var config = data.config;
config.baseUrl = 'http://localhost:8001/';