watch utils folder and build it when updated

aakansha/esm
Aakansha Doshi 10 months ago
parent 58567dd2b6
commit 7522285869

@ -72,7 +72,7 @@
"locales-coverage:description": "node scripts/locales-coverage-description.js", "locales-coverage:description": "node scripts/locales-coverage-description.js",
"prepare": "husky install", "prepare": "husky install",
"prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore", "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
"start": "yarn clear:workspaces && yarn workspace @excalidraw/utils run build:esm && yarn --cwd ./excalidraw-app start", "start": "yarn clear:workspaces && yarn workspace @excalidraw/utils run build:esm && yarn --cwd ./excalidraw-app start & node scripts/watchUtils.js",
"start:app:production": "npm run build && npx http-server build -a localhost -p 5001 -o", "start:app:production": "npm run build && npx http-server build -a localhost -p 5001 -o",
"test:all": "yarn test:typecheck && yarn test:code && yarn test:other && yarn test:app --watch=false", "test:all": "yarn test:typecheck && yarn test:code && yarn test:other && yarn test:app --watch=false",
"test:app": "vitest", "test:app": "vitest",

@ -121,5 +121,7 @@ const createESMRawBuild = async () => {
fs.writeFileSync("meta-raw-prod.json", JSON.stringify(rawProd.metafile)); fs.writeFileSync("meta-raw-prod.json", JSON.stringify(rawProd.metafile));
}; };
console.info("BUILDING UTILS STARTED");
createESMRawBuild(); createESMRawBuild();
createESMBrowserBuild(); 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");
});

@ -4660,7 +4660,7 @@ check-error@^1.0.2, check-error@^1.0.3:
dependencies: dependencies:
get-func-name "^2.0.2" get-func-name "^2.0.2"
"chokidar@>=3.0.0 <4.0.0", chokidar@^3.5.1, chokidar@^3.5.3: chokidar@3.6.0, "chokidar@>=3.0.0 <4.0.0", chokidar@^3.5.1, chokidar@^3.5.3:
version "3.6.0" version "3.6.0"
resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b"
integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==

Loading…
Cancel
Save