Updates
This commit is contained in:
parent
1c26586478
commit
cee4bc0478
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@ -1,2 +1,5 @@
|
||||
#!/usr/bin/env bun
|
||||
declare global {
|
||||
var REDEPLOYMENTS: number;
|
||||
}
|
||||
export {};
|
||||
|
1
dist/index.js
vendored
1
dist/index.js
vendored
@ -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");
|
||||
|
2
dist/tsconfig.tsbuildinfo
vendored
2
dist/tsconfig.tsbuildinfo
vendored
File diff suppressed because one or more lines are too long
3
dist/utils/run.js
vendored
3
dist/utils/run.js
vendored
@ -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) {
|
||||
|
6
dist/utils/start.js
vendored
6
dist/utils/start.js
vendored
@ -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);
|
||||
|
6
index.ts
6
index.ts
@ -8,6 +8,12 @@ import type { NodeCIConfig } from "./types";
|
||||
|
||||
const WORK_DIR = process.cwd();
|
||||
|
||||
declare global {
|
||||
var REDEPLOYMENTS: number;
|
||||
}
|
||||
|
||||
global.REDEPLOYMENTS = 0;
|
||||
|
||||
function run() {
|
||||
try {
|
||||
const configText = fs.readFileSync(
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/buncid",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Simple CI/CD process For Bun runtime",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { spawn, ChildProcess } from "child_process";
|
||||
import colors from "./console-colors";
|
||||
|
||||
let redeployments = 0;
|
||||
|
||||
const KILL_SIGNAL: NodeJS.Signals | number = "SIGTERM";
|
||||
|
||||
/**
|
||||
@ -31,7 +29,7 @@ export default function run(command: string): ChildProcess | null {
|
||||
killSignal: KILL_SIGNAL,
|
||||
});
|
||||
|
||||
redeployments++;
|
||||
global.REDEPLOYMENTS = global.REDEPLOYMENTS + 1;
|
||||
|
||||
return newChildProcess;
|
||||
} catch (error: any) {
|
||||
|
@ -5,8 +5,6 @@ import preflightFn from "./preflight";
|
||||
import run from "./run";
|
||||
import killChild from "./kill-child";
|
||||
|
||||
let redeployments = 0;
|
||||
|
||||
let childProcess: ChildProcess | null = null;
|
||||
|
||||
const pTitle = "buncid";
|
||||
@ -64,12 +62,14 @@ export default function startProcess({
|
||||
fs.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
|
||||
console.log(`${colors.BgBlue}File Changed${colors.Reset}`);
|
||||
|
||||
if (redeployments == 0) return;
|
||||
if (global.REDEPLOYMENTS == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (childProcess) {
|
||||
console.log("******************************");
|
||||
console.log(
|
||||
`******** ${colors.FgBlue}Rebuilding ${colors.FgMagenta}${redeployments}${colors.Reset} ********`
|
||||
`******** ${colors.FgBlue}Rebuilding ${colors.FgMagenta}${global.REDEPLOYMENTS}${colors.Reset} ********`
|
||||
);
|
||||
console.log("******************************");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user