-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (39 loc) · 1.23 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
"use strict";
var fse = require("fs-extra");
var spawn = require("cross-spawn");
var ceneLibs = [
"cene"
];
async function runCeneCli(args) {
await new Promise((resolve, reject) => {
spawn("npm", ["run", "cene", "--"].concat(args), {
stdio: ["ignore", "inherit", "inherit"]
})
.on("close", code => {
if (code !== 0)
return void reject(
new Error(`Cene exited with code ${code}`));
resolve();
});
});
}
async function build(opt_options) {
var options = Object.assign({
minify: true
}, opt_options);
await fse.ensureDir("build/lib/");
await fse.copy("src/", "build/src/");
for (const lib of ceneLibs) {
await fse.copy(`node_modules/${lib}/lib-cene/`, `build/lib/${lib}/`);
}
var ceneCliArgs = "build.cene -i build/ -o dist/";
if (options.minify)
ceneCliArgs += " -m";
await runCeneCli(ceneCliArgs.split(" "));
}
exports.clean = async () => {
await fse.remove("build/");
await fse.remove("dist/");
};
exports.build = async () => await build();
exports[ "build-debug" ] = async () => await build({ minify: false });