From 7d3d7f59a2db9b306ef7059dc2e025b956450ce1 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 4 Feb 2016 14:45:51 -0600 Subject: [PATCH] chore(gulpfile): separate source and e2e watch tasks --- gulpfile.js | 87 ++++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 24018a916f..740908f758 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -72,50 +72,29 @@ gulp.task('build', function(done){ ); }); -/** - * Build Ionic sources, with typechecking and debug statements removed - */ -gulp.task('build.release', function(done){ - IS_RELEASE = true; - runSequence( - 'clean', - 'copy.libs', - ['bundle', 'sass', 'fonts', 'copy.scss'] - ); +gulp.task('watch', ['build'], function() { + watchTask('transpile'); }); -gulp.task('watch', function(done) { - runSequence( - 'copy.libs', - 'build', - 'serve', - function() { - watch([ - 'ionic/**/*.ts', - '!ionic/components/*/test/**/*', - '!ionic/util/test/*' - ], - function(file) { - if (file.event === "unlink") { - deleteFile(file); - } else { - gulp.start('bundle.system'); - } - } - ); - - watch('ionic/components/*/test/**/*', function(file) { - gulp.start('e2e.build'); - }); - - watch('ionic/**/*.scss', function() { - gulp.start('sass'); - }); - - done(); +function watchTask(task){ + watch([ + 'ionic/**/*.ts', + '!ionic/components/*/test/**/*', + '!ionic/util/test/*' + ], + function(file) { + if (file.event === "unlink") { + deleteFile(file); + } else { + gulp.start(task); + } } ); + watch('ionic/**/*.scss', function() { + gulp.start('sass'); + }); + function deleteFile(file) { //TODO // var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/")); @@ -131,7 +110,7 @@ gulp.task('watch', function(done) { // gulp.start('bundle.system'); // }); } -}); +} gulp.task('serve', function() { connect.server({ @@ -146,6 +125,7 @@ gulp.task('clean', function(done) { del(['dist/**', '!dist'], done); }); + /** * Source build tasks */ @@ -336,9 +316,18 @@ gulp.task('copy.libs', function() { return merge([webAnimations, libs]); }); + /** * Test build tasks */ +gulp.task('watch.e2e', ['e2e'], function() { + watchTask('bundle.system'); + + watch('ionic/components/*/test/**/*', function(file) { + gulp.start('e2e.build'); + }); +}); + gulp.task('e2e', ['e2e.build', 'bundle.system', 'copy.libs', 'sass', 'fonts']); gulp.task('e2e.build', function() { @@ -436,6 +425,7 @@ gulp.task('tests', function() { .pipe(gulp.dest('dist/tests')) }) + /** * Demos */ @@ -544,6 +534,7 @@ gulp.task('build.demos', function() { } }); + /** * Tests */ @@ -559,6 +550,7 @@ gulp.task('karma-watch', function() { return karma.start({ configFile: __dirname + '/scripts/karma/karma-watch.conf.js' }) }); + /** * Release */ @@ -679,6 +671,19 @@ gulp.task('publish.npm', function(done) { }); }); +/** + * Build Ionic sources, with typechecking and debug statements removed + */ +gulp.task('build.release', function(done){ + IS_RELEASE = true; + runSequence( + 'clean', + 'copy.libs', + ['bundle', 'sass', 'fonts', 'copy.scss'] + ); +}); + + /** * Docs */ @@ -695,4 +700,4 @@ gulp.task('tooling', function(){ gulp.src('*tooling/**/*') .pipe(gulp.dest('dist')); }) -}) +});