-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (35 loc) · 1.12 KB
/
gulpfile.js
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
"use strict";
const gulp = require("gulp");
const nodemon = require("gulp-nodemon");
const gulpSourcemaps = require("gulp-sourcemaps");
const ts = require("gulp-typescript");
var tsProject = ts.createProject("tsconfig.json");
// Build
gulp.task("build", () => {
gulp.src("./src/config.json")
.pipe(gulp.dest("dist/"));
// 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"
});
}), () => {
}));