-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
45 lines (37 loc) · 1018 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
"use strict"
const gulp = require("gulp")
const tsc = require("gulp-typescript")
const sourcemaps = require("gulp-sourcemaps")
const del = require("del")
gulp.task("clean", () => del(["lib"]))
const tstProject = tsc.createProject("tsconfig.json",
{ module: "commonjs", typescript: require("typescript") })
gulp.task("build-src", () => gulp.src(["src/**/*.ts"])
.pipe(sourcemaps.init())
.pipe(tstProject())
.on("error", (_) => {process.exit(1)})
.js.pipe(sourcemaps.write(".", { sourceRoot: (file) => file.cwd + "/src" }))
.pipe(gulp.dest("lib/"))
)
const tsDtsProject = tsc.createProject("tsconfig.json", {
declaration: true,
noResolve: false,
typescript: require("typescript")
})
gulp.task("build-dts", () => gulp.src(["src/**/*.ts"])
.pipe(tsDtsProject())
.on("error", (_) => {process.exit(1)})
.dts.pipe(gulp.dest("lib"))
)
gulp.task("build",
gulp.series("clean",
gulp.parallel(
"build-src",
"build-dts"
)
)
)
gulp.task(
"default",
gulp.series("build")
)