watch utils folder and build it when updated
This commit is contained in:
@@ -121,5 +121,7 @@ const createESMRawBuild = async () => {
|
||||
fs.writeFileSync("meta-raw-prod.json", JSON.stringify(rawProd.metafile));
|
||||
};
|
||||
|
||||
console.info("BUILDING UTILS STARTED");
|
||||
createESMRawBuild();
|
||||
createESMBrowserBuild();
|
||||
console.info("BUILDING UTILS COMPLETE");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const chokidar = require("chokidar");
|
||||
const path = require("path");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
const BASE_PATH = `${path.resolve(`${__dirname}/..`)}`;
|
||||
const utilsDir = `${BASE_PATH}/packages/utils/src`;
|
||||
// One-liner for current directory
|
||||
chokidar.watch(utilsDir).on("change", (event) => {
|
||||
console.info("Watching", event);
|
||||
try {
|
||||
execSync(`yarn workspace @excalidraw/utils run build:src`);
|
||||
} catch (err) {
|
||||
console.error("Error when building workspace", err);
|
||||
}
|
||||
console.info("BUILD DONE");
|
||||
});
|
||||
Reference in New Issue
Block a user