Skip to content

Commit 85b8a15

Browse files
committed
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 angular#2369
1 parent 920982c commit 85b8a15

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

gulpfile.js

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -240,36 +240,47 @@ gulp.task('build/checkCircularDependencies', function (done) {
240240
done();
241241
});
242242

243+
function jsServeDev() {
244+
return jsserve(gulp, gulpPlugins, {
245+
path: CONFIG.dest.js.dev.es5,
246+
port: 8000
247+
})();
248+
}
249+
250+
function jsServeProd() {
251+
return jsserve(gulp, gulpPlugins, {
252+
path: CONFIG.dest.js.prod.es5,
253+
port: 8001
254+
})();
255+
}
256+
257+
function jsServeDartJs() {
258+
return jsserve(gulp, gulpPlugins, {
259+
path: CONFIG.dest.js.dart2js,
260+
port: 8002
261+
})();
262+
}
263+
243264
// ------------------
244265
// web servers
245266
gulp.task('serve.js.dev', ['build.js.dev'], function(neverDone) {
246267
watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev');
247-
248-
jsserve(gulp, gulpPlugins, {
249-
path: CONFIG.dest.js.dev.es5,
250-
port: 8000
251-
})();
268+
jsServeDev();
252269
});
253270

254-
gulp.task('serve.e2e.dev', ['build.js.dev', 'build.js.cjs', 'build.css.material'], function(neverDone) {
255-
watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev');
256-
watch('modules/**', { ignoreInitial: true }, '!build.js.cjs');
271+
gulp.task('serve.js.prod', jsServeProd);
257272

258-
jsserve(gulp, gulpPlugins, {
259-
path: CONFIG.dest.js.dev.es5,
260-
port: 8000
261-
})();
273+
gulp.task('serve.e2e.dev', ['build.js.dev', 'build.js.cjs', 'build.css.material'], function(neverDone) {
274+
watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.dev', '!build.js.cjs']);
275+
jsServeDev();
262276
});
263277

264-
gulp.task('serve.js.prod', jsserve(gulp, gulpPlugins, {
265-
path: CONFIG.dest.js.prod.es5,
266-
port: 8001
267-
}));
278+
gulp.task('serve.e2e.prod', ['build.js.prod', 'build.js.cjs', 'build.css.material'], function(neverDone) {
279+
watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.prod', '!build.js.cjs']);
280+
jsServeProd();
281+
});
268282

269-
gulp.task('serve.js.dart2js', jsserve(gulp, gulpPlugins, {
270-
path: CONFIG.dest.js.dart2js,
271-
port: 8002
272-
}));
283+
gulp.task('serve.js.dart2js', jsServeDartJs);
273284

274285
gulp.task('serve/examples.dart', pubserve(gulp, gulpPlugins, {
275286
command: DART_SDK.PUB,
@@ -668,6 +679,9 @@ gulp.task('!broccoli.js.dev', function() {
668679
return angularBuilder.rebuildBrowserDevTree();
669680
});
670681

682+
gulp.task('!broccoli.js.prod', function() {
683+
return angularBuilder.rebuildBrowserProdTree();
684+
});
671685

672686
gulp.task('build.js.dev', ['build/clean.js'], function(done) {
673687
runSequence(
@@ -678,8 +692,8 @@ gulp.task('build.js.dev', ['build/clean.js'], function(done) {
678692
);
679693
});
680694

681-
gulp.task('build.js.prod', ['build.tools'], function() {
682-
return angularBuilder.rebuildBrowserProdTree();
695+
gulp.task('build.js.prod', ['build.tools'], function(done) {
696+
runSequence('!broccoli.js.prod', sequenceComplete(done));
683697
});
684698

685699

protractor-js-prod.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var data = module.exports = require('./protractor-shared.js');
2+
var config = data.config;
3+
config.baseUrl = 'http://localhost:8001/';

0 commit comments

Comments
 (0)