-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
70 lines (56 loc) · 1.89 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* eslint-disable @typescript-eslint/typedef */
const gulp = require('gulp');
const typescript = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const eslint = require('gulp-eslint');
const del = require('del');
const path = require('path');
const project = typescript.createProject('tsconfig.json');
gulp.task('lint', () =>
gulp.src('src/**/*.ts')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError()));
gulp.task('build', () =>
{
del.sync(['bin/**/*.*']);
const tsCompile = gulp.src('src/**/*.ts')
.pipe(sourcemaps.init({ base: 'src' }))
.pipe(project());
tsCompile.pipe(gulp.dest('bin/'));
gulp.src('src/**/*.js').pipe(gulp.dest('bin/'));
gulp.src('src/**/*.json').pipe(gulp.dest('bin/'));
gulp.src('src/**/*.lang').pipe(gulp.dest('bin/'));
return tsCompile.js
.pipe(sourcemaps.write('.', { sourceRoot: '../src' }))
.pipe(gulp.dest('bin/'));
});
gulp.task('build:tests', () =>
{
del.sync(['test/**/*.js']);
const tsCompile = gulp.src('test/**/*.ts')
.pipe(sourcemaps.init({ base: 'test' }))
.pipe(project());
tsCompile.pipe(gulp.dest('test/'));
return tsCompile.js
.pipe(sourcemaps.mapSources(sourcePath => path.join(__dirname, 'test', sourcePath)))
.pipe(sourcemaps.write())
.pipe(gulp.dest('test/'));
});
gulp.task('build:scripts', () =>
{
del.sync(['scripts/**/*.js']);
del.sync(['scripts/**/*.js.map']);
del.sync(['scripts/**/*.d.ts']);
const tsCompile = gulp.src('scripts/**/*.ts')
.pipe(sourcemaps.init({ base: 'scripts' }))
.pipe(project());
tsCompile.pipe(gulp.dest('scripts/'));
return tsCompile.js
.pipe(sourcemaps.write('.', { sourceRoot: '../scripts' }))
.pipe(gulp.dest('scripts/'));
});
gulp.task('default', gulp.series('build'));
gulp.task('build:vscode', gulp.series('lint', 'build'));
gulp.task('pause', cb => setTimeout(cb, 1e3));
gulp.task('tests', gulp.series('lint', 'build', 'pause', 'build:tests'));