From 69eb6c1128fa4360fa93899100325661678bdc06 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Tue, 4 Feb 2025 07:43:18 +0100 Subject: [PATCH] Updates --- .vscode/settings.json | 3 +++ bun.lockb | Bin 5747 -> 5067 bytes buncid.ts | 2 ++ dist/buncid.d.ts | 1 + dist/buncid.js | 1 + dist/tsconfig.tsbuildinfo | 2 +- dist/utils/start.js | 13 +++++++++---- package.json | 3 +-- utils/start.ts | 13 ++++++++----- 9 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..24b4d5b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cursor.aipreview.enabled": true +} \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 70c050e41b84a152abf997e8f8562b6511368dbd..8ecc3777e8dde0090c9c654e5c0b5cd3b4cdd039 100755 GIT binary patch delta 765 zcmeyYb6S0Zo~H4?r?uDrJBK`MzT(FvpV$08!8J5P;Q2K>$1XXy&^z+h!VF-*GcjDA zDTZfag@&O9P=K3(p}~cbfq@4|%K`aZK>9e4&k3Z_<+&$5)ZeVY=)*Yq4U-LHz+_Ek zd!~tule3uZm@Y6*Ud3$3C^Gpavpu8VWK9-(#{S8fEcQ(2nI^Adv8rbQ8V$lsK+Fcj zAb?B*ZDe2vi$Z7+p96?N>VZyT0P%rN1p^Qb;sc!w2L#MF18X4Jg3UWwYZxa#W%p)e zoovVvKKTYa@8qc*-i+*%9|CzD9K4fVIlUPA zzzZaRAcc2w9>3CL4SoSVkf%W*4N}eu#2{lp#)FIoX$R30pxO?AwJ~x}p2{yT1(JX% z2GJj&iZu8qU*a#BoFL$53QIVg`8LO11M)Q2^i)HOh3Of_ b3ci0D0uYtP!kevxfC=!wh{$FxkxV84g`js7 delta 1130 zcmb_bTS$~a6#i#+bFcrumy}wU5`}Q1+>2{hbXP5~MU5142~D=L?DCLF#+Id0(G{`f zJQQTqTNIel?vq5h^^lbkQbJTuWhE2_YG5I2=lt$K^xT1&@0>Z;nKS2Q{`BfA?v=ya zUzu)f=qYOGxcNIg@H$|fsUDpksqTLgn)iJufrp>6B$bp{IEU9Mv8bzT&;G-Q4m9m* zZQZ-8sp&v#iwg}*lGK%8l4M3)j8+bEuFxPWK`C>Qg0(}42iYK8 zS4c?HKl$p^?^bu9-pQX8hpJA0ov1JF&%B*E+fh^V)^X~iZ`F>m>3JOml2(P4FhsZT=5gqFxCg&`t0AwJX2xmne8@!N@ zW{cSp

Dk=yI`-gXEr< Wg@MPG;}B(`R { + fs_1.default.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => { + if (global.DEPLOYING == 1) + return; clearTimeout(timeout); timeout = setTimeout(() => { console.log(`${console_colors_1.default.BgBlue}File Changed${console_colors_1.default.Reset}`); if (global.REDEPLOYMENTS == 0) { return; } + global.DEPLOYING = 1; if (childProcess) { console.log("******************************"); console.log(`******** ${console_colors_1.default.FgBlue}Rebuilding ${console_colors_1.default.FgMagenta}${global.REDEPLOYMENTS}${console_colors_1.default.Reset} ********`); @@ -60,10 +62,10 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir if (postflight) { const runPostflight = (0, preflight_1.default)(postflight, true); if (!runPostflight) { - // TODO: Action to take if postflight fails console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Postflight Failed.`); } } + global.DEPLOYING = 0; } else { process.exit(); @@ -76,6 +78,9 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir process.exit(); } } + else { + global.DEPLOYING = 0; + } }, DEBOUNCE); }); } diff --git a/package.json b/package.json index 6ab61f0..ee817c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/buncid", - "version": "1.0.6", + "version": "1.0.7", "description": "Simple CI/CD process For Bun runtime", "main": "dist/index.js", "bin": { @@ -22,7 +22,6 @@ "author": "Benjamin Toby", "license": "MIT", "dependencies": { - "chokidar": "^4.0.3", "kill-port": "^2.0.1" }, "devDependencies": { diff --git a/utils/start.ts b/utils/start.ts index bc01c1c..c619be8 100755 --- a/utils/start.ts +++ b/utils/start.ts @@ -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); });