MCPcopy
hub / github.com/streetwriters/notesnook / onChange

Function onChange

apps/desktop/scripts/dev.mjs:55–94  ·  view source on GitHub ↗
(first)

Source from the content-addressed store, hash-verified

53});
54
55async function onChange(first) {
56 if (first) {
57 await fs.rm("./build/", { force: true, recursive: true });
58
59 await exec(
60 "npm run postinstall --verbose",
61 path.join(root, "node_modules", "electron")
62 );
63
64 await exec("yarn electron-builder install-app-deps", root);
65 }
66
67 await exec(`yarn run bundle`, root);
68 await exec(`yarn run build`, root);
69
70 if (await isBundleSame()) {
71 console.log("Bundle is same. Doing nothing.");
72 return;
73 }
74
75 if (first) {
76 await spawnAndWaitUntil(
77 ["npm", "run", "start:desktop"],
78 path.join(__dirname, "..", "..", "web"),
79 (data) => data.includes("Network: use --host to expose")
80 );
81 }
82
83 if (!first) {
84 console.log("Restarting...", RESTARTABLE_PROCESSES.length);
85 await killProcesses(RESTARTABLE_PROCESSES);
86 }
87
88 execAsync(
89 "yarn",
90 ["electron", path.join("build", "electron.js")],
91 true,
92 cleanup
93 );
94}
95
96function spawnAndWaitUntil(cmd, cwd, predicate) {
97 return new Promise((resolve) => {

Callers 7

dev.mjsFile · 0.70
ColorPickerFunction · 0.50
index.tsxFile · 0.50
handleKeyDownFunction · 0.50
TipTapFunction · 0.50
NumberInputFunction · 0.50
onScrollFunction · 0.50

Calls 6

isBundleSameFunction · 0.85
spawnAndWaitUntilFunction · 0.85
killProcessesFunction · 0.85
execAsyncFunction · 0.85
execFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected