mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 11:15:36 -05:00
Added npm run dev (#1572)
This commit is contained in:
committed by
GitHub
parent
3a3cb7b11d
commit
7813c3f03f
33
pyscript.core/dev.cjs
Normal file
33
pyscript.core/dev.cjs
Normal file
@@ -0,0 +1,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 && npm run rollup:pyscript",
|
||||
{ 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();
|
||||
Reference in New Issue
Block a user