-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdev.cjs
More file actions
33 lines (28 loc) · 986 Bytes
/
dev.cjs
File metadata and controls
33 lines (28 loc) · 986 Bytes
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
let queue = Promise.resolve();
const { exec } = require("node:child_process");
const build = (fileName) => {
if (fileName) console.log(fileName, "changed");
else console.log("building without optimizations");
queue = queue.then(
() =>
new Promise((resolve, reject) => {
exec(
"npm run rollup:xworker && npm run rollup:core",
{ cwd: __dirname, env: { ...process.env, NO_MIN: true } },
(error) => {
if (error) reject(error);
else
resolve(
console.log(fileName || "", "build completed"),
);
},
);
}),
);
};
const options = {
ignored: /\/(?:__template|interpreters|xworker)\.[mc]?js$/,
persistent: true,
};
require("chokidar").watch("./esm", options).on("change", build);
build();