mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(electron): add script to watch for src/public changes
This commit is contained in:
parent
091f06253f
commit
e7c4e037e0
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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user