add custom watchbuild script to work around rollup

typescript
Drake 2 years ago
parent 9df8feffda
commit 237f7ee1fc

@ -5,12 +5,13 @@
"main": "src/index.js",
"scripts": {
"build": "rollup --config rollup.config.js",
"watch": "rollup --config rollup.config.js --watch"
"watch": "node watchbuild"
},
"author": "Drake",
"license": "BSD-3-Clause",
"dependencies": {
"@ltd/j-toml": "^1.30.0",
"chokidar": "^3.5.3",
"idb-keyval": "^6.2.0",
"nests": "^2.3.1",
"rollup-plugin-jscc": "^2.0.0",

@ -0,0 +1,27 @@
//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
})
Loading…
Cancel
Save