Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(electron): add script to watch for src/public changes
Elian Dorane7c4e037e045
diff --git a/bin/watch-dist.ts b/bin/watch-dist.tsnew file mode 100644index 0000000000..490ffbe5d5--- /dev/null+++ b/bin/watch-dist.ts@@ -0,0 +1,18 @@+import chokidar from "chokidar";+import fs from "fs";+import path from "path";++const emptyCallback = () => {};++function onFileChanged(sourceFile: string) {+ const destFile = path.join("dist", sourceFile);+ console.log(`${sourceFile} -> ${destFile}`);+ fs.copyFile(sourceFile, destFile, emptyCallback);+}++const sourceDir = "src/public";++chokidar+ .watch(sourceDir)+ .on("change", onFileChanged);+console.log(`Watching for changes to ${sourceDir}...`);\ No newline at end of filediff --git a/package.json b/package.jsonindex bb30df31c9..df0468fe53 100644--- a/package.json+++ b/package.json@@ -41,6 +41,7 @@"make-electron": "npm run webpack && npm run prepare-dist && electron-forge make","package-electron": "electron-forge package","prepare-dist": "rimraf ./dist && tsc && tsx ./bin/copy-dist.ts",+ "watch-dist": "tsx ./bin/watch-dist.ts","update-build-info": "tsx bin/update-build-info.ts","errors": "tsc --watch --noEmit","integration-edit-db": "cross-env TRILIUM_INTEGRATION_TEST=edit TRILIUM_PORT=8081 TRILIUM_DATA_DIR=./integration-tests/db nodemon src/main.ts",