This commit is contained in:
Benjamin Toby
2025-02-04 07:43:18 +01:00
parent 0375c02931
commit 69eb6c1128
9 changed files with 26 additions and 12 deletions
+8 -5
View File
@@ -4,7 +4,6 @@ import colors from "./console-colors";
import preflightFn from "./preflight";
import run from "./run";
import killChild from "./kill-child";
import chokidar from "chokidar";
let childProcess: ChildProcess | null = null;
@@ -59,9 +58,9 @@ export default function startProcess({
console.log("Watching", redeploy_file);
const watcher = chokidar.watch(redeploy_file, { ignoreInitial: true });
fs.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
if (global.DEPLOYING == 1) return;
watcher.on("change", (path, stats) => {
clearTimeout(timeout);
timeout = setTimeout(() => {
@@ -71,6 +70,8 @@ export default function startProcess({
return;
}
global.DEPLOYING = 1;
if (childProcess) {
console.log("******************************");
console.log(
@@ -97,13 +98,13 @@ export default function startProcess({
);
if (!runPostflight) {
// TODO: Action to take if postflight fails
console.log(
`${colors.FgRed}Error:${colors.Reset} Postflight Failed.`
);
}
}
global.DEPLOYING = 0;
} else {
process.exit();
}
@@ -115,6 +116,8 @@ export default function startProcess({
);
process.exit();
}
} else {
global.DEPLOYING = 0;
}
}, DEBOUNCE);
});