-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (44 loc) · 1.47 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
const gulp = require("gulp");
const gulpTS = require("gulp-typescript");
const gulpTSLint = require('gulp-tslint').default;
const gulpSourcemaps = require('gulp-sourcemaps');
const gulpNodemon = require('gulp-nodemon');
const tsLint = require('tslint');
const del = require('del');
const path = require('path');
const project = gulpTS.createProject("tsconfig.json");
const typeCheck = tsLint.Linter.createProgram('tsconfig.json');
gulp.task('lint', function() {
return gulp.src('./src/**/*.ts')
.pipe(gulpTSLint({
configuration: 'tslint.json',
formatter: 'verbose',
program: typeCheck
}))
.pipe(gulpTSLint.report());
});
gulp.task('build', gulp.series(['lint'], () => {
del.sync(['./build/**/*.*']);
const tsCompile = gulp.src('./src/**/*.ts')
.pipe(gulpSourcemaps.init())
.pipe(project());
return tsCompile.js.pipe(gulpSourcemaps.write({
sourceRoot: file => path.relative(path.join(file.cwd, file.path), file.base)
}))
.pipe(gulp.dest('./build/'));
}));
gulp.task('watch', gulp.series(['build'], () => {
gulp.watch('./src/**/*.ts', gulp.series(['build']));
}));
gulp.task('start',gulp.series(['build'], () => {
return gulpNodemon({
script: './build/tsumugi.js',
watch: './build/tsumugi.js'
});
}));
gulp.task('serve', gulp.parallel(['watch'], () => {
return gulpNodemon({
script: './build/tsumugi.js',
watch: './build/'
});
}));