mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
feat(electron): add script to watch for src/public changes
This commit is contained in:
18
bin/watch-dist.ts
Normal file
18
bin/watch-dist.ts
Normal file
@@ -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}...`);
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user