-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
53 lines (44 loc) · 1.43 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
42
43
44
45
46
47
48
49
50
51
52
53
var gulp = require("gulp");
var ts = require("gulp-typescript");
var nodemon = require("gulp-nodemon");
var tslint = require("gulp-tslint");
var del = require("del");
gulp.task('clean-dist', () => {
return del('./dist');
});
gulp.task('copy-config', () => {
return gulp.src('./src/config.json')
.pipe(gulp.dest('./dist'));
});
gulp.task('copy-package.json', () => {
return gulp.src('./package.json')
.pipe(gulp.dest('./dist'));
});
gulp.task('copy-html', () => {
return gulp.src('./src/web/html/*')
.pipe(gulp.dest('./dist/web/html'));
});
// Tslint config is not included in this file, editors like Visual Studio Code automatically look for this file
// and applies the rules to code, you then get feedback while writing code.
gulp.task('lint', () => {
return gulp.src('./src/**/*.ts')
.pipe(tslint())
.pipe(tslint.report());
});
gulp.task('compile', () => {
return gulp.src(['src/**/*.ts', '!src/tests/**/*.spec.ts'])
.pipe(ts(require('./tsconfig.json').compilerOptions))
.pipe(gulp.dest('./dist'))
});
gulp.task('build', gulp.series(['clean-dist', 'copy-config', 'copy-package.json', 'copy-html', 'lint', 'compile']));
gulp.task('watch', (done) => {
gulp.watch(['src/**/*.ts', '!src/tests/**/*.spec.ts'], gulp.series(['build']));
nodemon({
delay: 100,
script: "dist/main.js",
ignore: ['gulpfile.js'],
ext: 'js'
});
done();
});
gulp.task('default', gulp.series(['build', 'watch']));