-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.ts
62 lines (52 loc) · 1.62 KB
/
gulpfile.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import del from "del";
import gulp from "gulp";
import mocha from "gulp-mocha";
import tslint from "gulp-tslint";
import ts from "gulp-typescript";
import { Configuration } from "webpack";
import webpack from "webpack-stream";
// tslint:disable-next-line:no-var-requires
const namedWithPath = require("vinyl-named-with-path");
const tsProject = ts.createProject("tsconfig.json");
const buildDir = "build";
gulp.task("lint", () => {
return gulp.src("src/**/*.ts")
.pipe(tslint({formatter: "verbose"}))
.pipe(tslint.report({summarizeFailureOutput: true}));
});
gulp.task("build-scripts", () => {
return gulp.src(["src/scripts/**/*.ts"])
.pipe(namedWithPath())
.pipe(webpack({config: require("./webpack.config.js")} as Configuration))
.pipe(gulp.dest("build/scripts"));
});
gulp.task("build", gulp.series("build-scripts", () => {
return gulp.src(["src/**/*.ts", "!src/scripts/**/*.ts"])
.pipe(tsProject())
.js.pipe(gulp.dest(buildDir));
}));
gulp.task("test-unit", () => {
return gulp.src(["src/**/*.spec.ts", "src/**/*.test.ts"])
.pipe(mocha({
exit: true,
reporter: "list",
require: ["ts-node/register"],
timeout: 5000,
} as MochaSetupOptions));
});
gulp.task("test-features", () => {
return gulp.src(["features/**/*.test.ts"])
.pipe(mocha({
exit: true,
reporter: "list",
require: ["ts-node/register"],
timeout: 5000,
} as MochaSetupOptions));
});
gulp.task("watch", () => {
gulp.watch("src/**/*.ts", gulp.series(["lint", "build", "test"]));
});
gulp.task("default", gulp.series("watch"));
gulp.task("clean", () => {
return del(buildDir);
});