chore(gulpfile): separate source and e2e watch tasks

This commit is contained in:
Tim Lancina
2016-02-04 14:45:51 -06:00
parent 612db32efc
commit 7d3d7f59a2

View File

@ -72,50 +72,29 @@ gulp.task('build', function(done){
); );
}); });
/** gulp.task('watch', ['build'], function() {
* Build Ionic sources, with typechecking and debug statements removed watchTask('transpile');
*/
gulp.task('build.release', function(done){
IS_RELEASE = true;
runSequence(
'clean',
'copy.libs',
['bundle', 'sass', 'fonts', 'copy.scss']
);
}); });
gulp.task('watch', function(done) { function watchTask(task){
runSequence( watch([
'copy.libs', 'ionic/**/*.ts',
'build', '!ionic/components/*/test/**/*',
'serve', '!ionic/util/test/*'
function() { ],
watch([ function(file) {
'ionic/**/*.ts', if (file.event === "unlink") {
'!ionic/components/*/test/**/*', deleteFile(file);
'!ionic/util/test/*' } else {
], gulp.start(task);
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();
} }
); );
watch('ionic/**/*.scss', function() {
gulp.start('sass');
});
function deleteFile(file) { function deleteFile(file) {
//TODO //TODO
// var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/")); // var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/"));
@ -131,7 +110,7 @@ gulp.task('watch', function(done) {
// gulp.start('bundle.system'); // gulp.start('bundle.system');
// }); // });
} }
}); }
gulp.task('serve', function() { gulp.task('serve', function() {
connect.server({ connect.server({
@ -146,6 +125,7 @@ gulp.task('clean', function(done) {
del(['dist/**', '!dist'], done); del(['dist/**', '!dist'], done);
}); });
/** /**
* Source build tasks * Source build tasks
*/ */
@ -336,9 +316,18 @@ gulp.task('copy.libs', function() {
return merge([webAnimations, libs]); return merge([webAnimations, libs]);
}); });
/** /**
* Test build tasks * 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', ['e2e.build', 'bundle.system', 'copy.libs', 'sass', 'fonts']);
gulp.task('e2e.build', function() { gulp.task('e2e.build', function() {
@ -436,6 +425,7 @@ gulp.task('tests', function() {
.pipe(gulp.dest('dist/tests')) .pipe(gulp.dest('dist/tests'))
}) })
/** /**
* Demos * Demos
*/ */
@ -544,6 +534,7 @@ gulp.task('build.demos', function() {
} }
}); });
/** /**
* Tests * Tests
*/ */
@ -559,6 +550,7 @@ gulp.task('karma-watch', function() {
return karma.start({ configFile: __dirname + '/scripts/karma/karma-watch.conf.js' }) return karma.start({ configFile: __dirname + '/scripts/karma/karma-watch.conf.js' })
}); });
/** /**
* Release * 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 * Docs
*/ */
@ -695,4 +700,4 @@ gulp.task('tooling', function(){
gulp.src('*tooling/**/*') gulp.src('*tooling/**/*')
.pipe(gulp.dest('dist')); .pipe(gulp.dest('dist'));
}) })
}) });