This commit is contained in:
Benjamin Toby
2025-01-22 12:31:32 +01:00
parent 1c26586478
commit cee4bc0478
9 changed files with 21 additions and 14 deletions
+3
View File
@@ -1,2 +1,5 @@
#!/usr/bin/env bun
declare global {
var REDEPLOYMENTS: number;
}
export {};
+1
View File
@@ -9,6 +9,7 @@ const path_1 = __importDefault(require("path"));
const console_colors_1 = __importDefault(require("./utils/console-colors"));
const start_1 = __importDefault(require("./utils/start"));
const WORK_DIR = process.cwd();
global.REDEPLOYMENTS = 0;
function run() {
try {
const configText = fs_1.default.readFileSync(path_1.default.join(WORK_DIR, "buncid.config.json"), "utf-8");
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = run;
const child_process_1 = require("child_process");
const console_colors_1 = __importDefault(require("./console-colors"));
let redeployments = 0;
const KILL_SIGNAL = "SIGTERM";
/**
* ## Preflight Function
@@ -27,7 +26,7 @@ function run(command) {
stdio: "inherit",
killSignal: KILL_SIGNAL,
});
redeployments++;
global.REDEPLOYMENTS = global.REDEPLOYMENTS + 1;
return newChildProcess;
}
catch (error) {
+3 -3
View File
@@ -9,7 +9,6 @@ const console_colors_1 = __importDefault(require("./console-colors"));
const preflight_1 = __importDefault(require("./preflight"));
const run_1 = __importDefault(require("./run"));
const kill_child_1 = __importDefault(require("./kill-child"));
let redeployments = 0;
let childProcess = null;
const pTitle = "buncid";
process.title = pTitle;
@@ -41,11 +40,12 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
console.log("Watching", redeploy_file);
fs_1.default.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
console.log(`${console_colors_1.default.BgBlue}File Changed${console_colors_1.default.Reset}`);
if (redeployments == 0)
if (global.REDEPLOYMENTS == 0) {
return;
}
if (childProcess) {
console.log("******************************");
console.log(`******** ${console_colors_1.default.FgBlue}Rebuilding ${console_colors_1.default.FgMagenta}${redeployments}${console_colors_1.default.Reset} ********`);
console.log(`******** ${console_colors_1.default.FgBlue}Rebuilding ${console_colors_1.default.FgMagenta}${global.REDEPLOYMENTS}${console_colors_1.default.Reset} ********`);
console.log("******************************");
try {
const runPreflight = (0, preflight_1.default)(preflight);