Updates
This commit is contained in:
Vendored
+9
-4
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = startProcess;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
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"));
|
||||
const chokidar_1 = __importDefault(require("chokidar"));
|
||||
let childProcess = null;
|
||||
const pTitle = "buncid";
|
||||
process.title = pTitle;
|
||||
@@ -36,14 +36,16 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
||||
process.exit();
|
||||
}
|
||||
console.log("Watching", redeploy_file);
|
||||
const watcher = chokidar_1.default.watch(redeploy_file, { ignoreInitial: true });
|
||||
watcher.on("change", (path, stats) => {
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user