forked from umijs/hox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
45 lines (40 loc) · 1.03 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
const gulp = require("gulp");
const del = require("del");
const rollupConfig = require("./rollup.config");
const rollup = require("rollup");
const ts = require("gulp-typescript");
gulp.task("clean-lib", function(callback) {
del("lib/**");
callback();
});
gulp.task("copy-files", function() {
return gulp
.src(["package.json", "README.md", "LICENSE"])
.pipe(gulp.dest("lib/"));
});
gulp.task("ts", function(callback) {
const tsProject = ts.createProject("tsconfig.json");
return tsProject
.src()
.pipe(tsProject())
.pipe(gulp.dest("lib"));
});
gulp.task(
"rollup",
gulp.series(
function() {
const tsProject = ts.createProject("tsconfig.json", {
module: "esnext"
});
return tsProject
.src()
.pipe(tsProject())
.pipe(gulp.dest("lib/es"));
},
async function() {
const bundle = await rollup.rollup(rollupConfig);
return await bundle.write(rollupConfig.output);
}
)
);
gulp.task("build", gulp.series("clean-lib", "copy-files", "ts", "rollup"));