Updates
This commit is contained in:
parent
2cd83295bf
commit
1c26586478
1
dist/index.js
vendored
1
dist/index.js
vendored
@ -14,7 +14,6 @@ function run() {
|
|||||||
const configText = fs_1.default.readFileSync(path_1.default.join(WORK_DIR, "buncid.config.json"), "utf-8");
|
const configText = fs_1.default.readFileSync(path_1.default.join(WORK_DIR, "buncid.config.json"), "utf-8");
|
||||||
const config = JSON.parse(configText);
|
const config = JSON.parse(configText);
|
||||||
const { start, preflight, postflight, build, redeploy_path, first_run, port, } = config;
|
const { start, preflight, postflight, build, redeploy_path, first_run, port, } = config;
|
||||||
/** @type {string | undefined} */
|
|
||||||
let redeployFile;
|
let redeployFile;
|
||||||
if (!redeploy_path) {
|
if (!redeploy_path) {
|
||||||
const defaultRedeployPath = path_1.default.join(WORK_DIR, "REDEPLOY");
|
const defaultRedeployPath = path_1.default.join(WORK_DIR, "REDEPLOY");
|
||||||
|
2
dist/tsconfig.tsbuildinfo
vendored
2
dist/tsconfig.tsbuildinfo
vendored
File diff suppressed because one or more lines are too long
3
dist/utils/kill-child.d.ts
vendored
3
dist/utils/kill-child.d.ts
vendored
@ -1,6 +1,7 @@
|
|||||||
|
import { ChildProcess } from "child_process";
|
||||||
/**
|
/**
|
||||||
* ## Kill Child Process Function
|
* ## Kill Child Process Function
|
||||||
* @param {string | number | (string | number)[]} [port]
|
* @param {string | number | (string | number)[]} [port]
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
export default function killChild(port?: string | number | (string | number)[]): Promise<boolean>;
|
export default function killChild(childProcess?: ChildProcess, port?: string | number | (string | number)[]): Promise<boolean>;
|
||||||
|
3
dist/utils/kill-child.js
vendored
3
dist/utils/kill-child.js
vendored
@ -15,13 +15,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.default = killChild;
|
exports.default = killChild;
|
||||||
const console_colors_1 = __importDefault(require("./console-colors"));
|
const console_colors_1 = __importDefault(require("./console-colors"));
|
||||||
const kill_port_1 = __importDefault(require("kill-port"));
|
const kill_port_1 = __importDefault(require("kill-port"));
|
||||||
let childProcess = null;
|
|
||||||
/**
|
/**
|
||||||
* ## Kill Child Process Function
|
* ## Kill Child Process Function
|
||||||
* @param {string | number | (string | number)[]} [port]
|
* @param {string | number | (string | number)[]} [port]
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
function killChild(port) {
|
function killChild(childProcess, port) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!childProcess)
|
if (!childProcess)
|
||||||
return false;
|
return false;
|
||||||
|
4
dist/utils/run.js
vendored
4
dist/utils/run.js
vendored
@ -23,12 +23,12 @@ function run(command) {
|
|||||||
if (!firstCommand) {
|
if (!firstCommand) {
|
||||||
throw new Error("No Starting Command Found in command string!");
|
throw new Error("No Starting Command Found in command string!");
|
||||||
}
|
}
|
||||||
let childProcess = (0, child_process_1.spawn)(firstCommand, startCommandArray, {
|
let newChildProcess = (0, child_process_1.spawn)(firstCommand, startCommandArray, {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
killSignal: KILL_SIGNAL,
|
killSignal: KILL_SIGNAL,
|
||||||
});
|
});
|
||||||
redeployments++;
|
redeployments++;
|
||||||
return childProcess;
|
return newChildProcess;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} running start command => ${error.message}`);
|
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} running start command => ${error.message}`);
|
||||||
|
2
dist/utils/start.js
vendored
2
dist/utils/start.js
vendored
@ -54,7 +54,7 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
|||||||
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Preflight Failed.`);
|
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Preflight Failed.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(0, kill_child_1.default)(port).then((kill) => {
|
(0, kill_child_1.default)(childProcess, port).then((kill) => {
|
||||||
if (kill) {
|
if (kill) {
|
||||||
childProcess = (0, run_1.default)(command);
|
childProcess = (0, run_1.default)(command);
|
||||||
if (postflight) {
|
if (postflight) {
|
||||||
|
3
index.ts
3
index.ts
@ -27,8 +27,7 @@ function run() {
|
|||||||
port,
|
port,
|
||||||
} = config;
|
} = config;
|
||||||
|
|
||||||
/** @type {string | undefined} */
|
let redeployFile: string | undefined;
|
||||||
let redeployFile;
|
|
||||||
|
|
||||||
if (!redeploy_path) {
|
if (!redeploy_path) {
|
||||||
const defaultRedeployPath = path.join(WORK_DIR, "REDEPLOY");
|
const defaultRedeployPath = path.join(WORK_DIR, "REDEPLOY");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/buncid",
|
"name": "@moduletrace/buncid",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "Simple CI/CD process For Bun runtime",
|
"description": "Simple CI/CD process For Bun runtime",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@ -2,14 +2,13 @@ import { ChildProcess } from "child_process";
|
|||||||
import colors from "./console-colors";
|
import colors from "./console-colors";
|
||||||
import kill from "kill-port";
|
import kill from "kill-port";
|
||||||
|
|
||||||
let childProcess: ChildProcess | null = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ## Kill Child Process Function
|
* ## Kill Child Process Function
|
||||||
* @param {string | number | (string | number)[]} [port]
|
* @param {string | number | (string | number)[]} [port]
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
export default async function killChild(
|
export default async function killChild(
|
||||||
|
childProcess?: ChildProcess,
|
||||||
port?: string | number | (string | number)[]
|
port?: string | number | (string | number)[]
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
if (!childProcess) return false;
|
if (!childProcess) return false;
|
||||||
|
@ -26,14 +26,14 @@ export default function run(command: string): ChildProcess | null {
|
|||||||
throw new Error("No Starting Command Found in command string!");
|
throw new Error("No Starting Command Found in command string!");
|
||||||
}
|
}
|
||||||
|
|
||||||
let childProcess = spawn(firstCommand, startCommandArray, {
|
let newChildProcess = spawn(firstCommand, startCommandArray, {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
killSignal: KILL_SIGNAL,
|
killSignal: KILL_SIGNAL,
|
||||||
});
|
});
|
||||||
|
|
||||||
redeployments++;
|
redeployments++;
|
||||||
|
|
||||||
return childProcess;
|
return newChildProcess;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log(
|
console.log(
|
||||||
`${colors.FgRed}Error:${colors.Reset} running start command => ${error.message}`
|
`${colors.FgRed}Error:${colors.Reset} running start command => ${error.message}`
|
||||||
|
@ -83,7 +83,7 @@ export default function startProcess({
|
|||||||
`${colors.FgRed}Error:${colors.Reset} Preflight Failed.`
|
`${colors.FgRed}Error:${colors.Reset} Preflight Failed.`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
killChild(port).then((kill) => {
|
killChild(childProcess, port).then((kill) => {
|
||||||
if (kill) {
|
if (kill) {
|
||||||
childProcess = run(command);
|
childProcess = run(command);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user