You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
demoncord-rewrite/watchbuild.js

31 lines
673 B

//stupid hack to
// - reload our config on every build
// - make the jscc plugin work properly
//why doesn't rollup watch do either of these things? no idea!
const loadConfigFile = require("rollup/loadConfigFile");
const path = require("path");
const rollup = require("rollup");
const chokidar = require("chokidar");
const process = require("child_process");
let ready = false;
const watch = chokidar.watch(
["./src", "./options.toml", "./rollup.config.js"],
{
persistent: true
}
);
watch.on("all", async (eve, path) => {
if (ready) {
process.execSync("pnpm run build");
}
});
watch.on("ready", () => {
console.log(`Watching files...`);
ready = true;
});