-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (35 loc) · 1.04 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
import gulp from 'gulp';
import gulpcache from 'gulp-cached';
import gulpESLintNew from 'gulp-eslint-new';
import gulpClean from 'gulp-clean';
import logger from 'gulp-logger';
import ts from 'gulp-typescript';
process.on('uncaughtException', function (err) {
console.log('Caught exception: ', err);
});
const tsProject = ts.createProject('tsconfig.json');
function buildESM() {
return tsProject
.src()
.pipe(gulpcache('ts-esm'))
.pipe(
logger({
before: 'Starting...',
after: 'Project compiled!',
extname: '.js',
showChange: true,
}),
)
.pipe(gulpESLintNew())
.pipe(gulpESLintNew.format())
.pipe(tsProject())
.pipe(gulp.dest('build'));
}
export async function clean() {
return gulp.src('./build/src', { read: false }).pipe(gulpClean());
}
export const build = buildESM;
export default build;
export function watch() {
gulp.watch(['src/**/*.ts', 'src/**/*.js'], gulp.series(buildESM));
}