diff --git a/Gulpfile.js b/Gulpfile.js index 848e7e8..136d185 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -5,6 +5,7 @@ var nodemon = require("gulp-nodemon"), file = require("gulp-file"), path = require('path'), tsProject = ts.createProject("tsconfig.json"), + clean = require("gulp-clean"), jasmine = require('gulp-jasmine'); @@ -14,13 +15,13 @@ var paths = { } gulp.task('test', ["build"], () => - gulp.src('bin/**/*[sS]pec.js') + gulp.src('./bin/**/*[sS]pec.js') // gulp-jasmine works on filepaths so you can't have any plugins before it .pipe(jasmine()) ); -gulp.task("typescript", () => { - return gulp.src("./src/**/*.ts") +gulp.task("typescript", ["clean"], () => { + return gulp.src(path.join(paths.src, "**", "*.ts")) .pipe(tsProject()) .js.pipe(gulp.dest(paths.bin)); }); @@ -34,7 +35,9 @@ gulp.task('watch', ['typescript'], () => { var tasks = [] changedFiles.forEach((file) => { // add typescript compilation if a *-ts file was changed - if (path.extname(file) === '.ts' && !~tasks.indexOf('typescript')) tasks.push('typescript') + if (path.extname(file) === '.ts' && !~tasks.indexOf('typescript')) { + tasks.push('typescript'); + } }) return tasks }, @@ -59,6 +62,11 @@ gulp.task("build", ["typescript"], () => { return; }); +gulp.task("clean", () => { + return gulp.src(path.join(paths.bin, "**", "*.js")) + .pipe(clean()); +}); + gulp.task("default", ["build"], () => { return; }); \ No newline at end of file diff --git a/package.json b/package.json index b60243b..17a920a 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@types/uuid": "^2.0.29", "@types/ws": "0.0.37", "gulp": "^3.9.1", + "gulp-clean": "^0.3.2", "gulp-conventional-changelog": "^1.1.0", "gulp-file": "^0.3.0", "gulp-jasmine": "^2.4.2",