-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (35 loc) · 1015 Bytes
/
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
/* eslint-env node */
const gulp = require('gulp'),
ts = require('gulp-typescript'),
gulpClean = require('gulp-clean'),
tsProject = ts.createProject('tsconfig.json')
function cleanBuild() {
return gulp.src('build/*', {read: false})
.pipe(gulpClean())
}
function cleanDist() {
return gulp.src('dist/*', {read: false})
.pipe(gulpClean())
}
const clean = gulp.parallel(cleanBuild, cleanDist)
function buildTS() {
return tsProject.src()
.pipe(tsProject())
.pipe(gulp.dest('build'))
}
function copySrcToDist() {
// Typescript is supposed to do this for us, but it creates js failes instead of json files and still attempts
// to require the json files, which of course fails. This is a quick and easy workaround.
return gulp
.src('build/src/**/*')
.pipe(gulp.dest('dist'))
}
const dist = gulp.series(clean, buildTS, copySrcToDist),
build = buildTS,
defaultBuild = gulp.series(clean, buildTS)
module.exports = {
build,
clean,
dist,
default: defaultBuild
}