Skip to content

Commit

Permalink
feat(buildchain): add clean task
Browse files Browse the repository at this point in the history
  • Loading branch information
wzr1337 committed Feb 8, 2017
1 parent 6a2bc46 commit 54d6214
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');


Expand All @@ -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));
});
Expand All @@ -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
},
Expand All @@ -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;
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 54d6214

Please sign in to comment.