mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
remove files in watch task when they are deleted
This commit is contained in:
44
gulpfile.js
44
gulpfile.js
@ -6,7 +6,6 @@ var karma = require('karma').server;
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var VinylFile = require('vinyl');
|
var VinylFile = require('vinyl');
|
||||||
var argv = require('yargs').argv;
|
var argv = require('yargs').argv;
|
||||||
var cached = require('gulp-cached');
|
|
||||||
var concat = require('gulp-concat');
|
var concat = require('gulp-concat');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
var gulpif = require('gulp-if');
|
var gulpif = require('gulp-if');
|
||||||
@ -47,9 +46,9 @@ var tscOptions = {
|
|||||||
rootDir: '.'
|
rootDir: '.'
|
||||||
}
|
}
|
||||||
var tscReporter = {
|
var tscReporter = {
|
||||||
error: function (error) {
|
error: function (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var flagConfig = {
|
var flagConfig = {
|
||||||
@ -85,13 +84,42 @@ gulp.task('watch', function(done) {
|
|||||||
'!ionic/components/*/test/**/*',
|
'!ionic/components/*/test/**/*',
|
||||||
'!ionic/util/test/*'
|
'!ionic/util/test/*'
|
||||||
],
|
],
|
||||||
function() {
|
function(file) {
|
||||||
runSequence('bundle', 'e2e');
|
if (file.event === "unlink") {
|
||||||
|
var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/"));
|
||||||
|
var relPath = file.history[0].replace(base, "").replace(".ts", ".js");
|
||||||
|
|
||||||
|
var es6Path = basePath + "dist/js/es6/" + relPath;
|
||||||
|
var commonPath = basePath + "dist/js/es5/common/" + relPath;
|
||||||
|
var systemPath = basePath + "dist/js/es5/system/" + relPath;
|
||||||
|
|
||||||
|
delete cache.caches.transpile[file.history[0]];
|
||||||
|
|
||||||
|
del([es6Path, commonPath, systemPath], function(){
|
||||||
|
gulp.start('bundle');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
gulp.start('bundle');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch('ionic/components/*/test/**/*', function() {
|
watch('ionic/components/*/test/**/*', function(file) {
|
||||||
gulp.start('e2e');
|
if (file.event === "unlink") {
|
||||||
|
var paths = file.history[0].split("ionic/components/");
|
||||||
|
var basePath = paths[0],
|
||||||
|
relPath = paths[1].split("/test").join("").replace(".ts", ".js");
|
||||||
|
|
||||||
|
var distPath = basePath + "dist/e2e/" + relPath;
|
||||||
|
|
||||||
|
delete cache.caches.e2e[file.history[0]];
|
||||||
|
|
||||||
|
del([distPath], function(){
|
||||||
|
gulp.start('e2e');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
gulp.start('e2e');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch('ionic/**/*.scss', function() {
|
watch('ionic/**/*.scss', function() {
|
||||||
|
Reference in New Issue
Block a user