-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
38 lines (34 loc) · 934 Bytes
/
gulpfile.babel.js
File metadata and controls
38 lines (34 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gulp from "gulp";
import {execSync} from "child_process";
import babel from "gulp-babel";
import eslint from "gulp-eslint";
import mocha from "gulp-spawn-mocha";
gulp.task("build", function () {
try {
execSync("rm -r dist/");
} catch (err) {
// Ignore
}
return gulp.src("src/**/*.js")
.pipe(babel())
.pipe(gulp.dest("dist/"));
});
gulp.task("test", function () {
return gulp.src(["test/**/*.js"])
.pipe(mocha({
compilers: "js:babel/register",
env: {
NODE_ENV: "test",
NODE_PATH: "./src/"
},
istanbul: true
}));
});
gulp.task("lint", function () {
return gulp.src(["src/**/*.js"])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task("default", ["test", "lint"], function () {
return gulp.watch(["src/**/*.js", "test/**/*.js"], ["test", "lint"]);
});