-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
51 lines (45 loc) · 1.38 KB
/
gulpfile.js
File metadata and controls
51 lines (45 loc) · 1.38 KB
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
"use strict";
const gulp = require("gulp");
const nodemon = require("gulp-nodemon");
const gulpSourcemaps = require("gulp-sourcemaps");
const ts = require("gulp-typescript");
const tslint = require("gulp-tslint");
var tsProject = ts.createProject("tsconfig.json");
// Lint
gulp.task("lint", () => {
// Use tslint with rules configured in tslint.json
return gulp.src("./src/**/*.ts")
.pipe(tslint({
formatter: "verbose"
}))
.pipe(tslint.report({
summarizeFailureOutput: true
}));
});
// Build
gulp.task("build", gulp.series("lint", () => {
// source -> TypeScript -> dist
return gulp.src("./src/**/*.ts")
.pipe(gulpSourcemaps.init())
.pipe(tsProject())
.pipe(gulpSourcemaps.write("."))
.pipe(gulp.dest("dist/"));
}));
// Test
gulp.task("test", gulp.series("build", () => {
// TODO: implement tests
}));
// Watch
gulp.task("watch", gulp.series("build", () => {
// Watch the TypeScript source files and recompile as needed
gulp.watch("./src/**/*.ts", gulp.series("build"));
}));
// start - build first, otherwise we intially run a stale index.js
gulp.task("start", gulp.series("build", gulp.parallel("watch", () => {
// Have nodemon watch for changes in dist and restart the bot as needed
return nodemon({
script: "./dist/index.js",
watch: "./dist"
});
}), () => {
}));