Updates
This commit is contained in:
parent
85a64f85d6
commit
7bcddc9517
0
dist/buncid.js
vendored
Normal file → Executable file
0
dist/buncid.js
vendored
Normal file → Executable file
0
dist/rebuilds/next-js/index.js
vendored
Normal file → Executable file
0
dist/rebuilds/next-js/index.js
vendored
Normal file → Executable file
2
dist/tsconfig.tsbuildinfo
vendored
2
dist/tsconfig.tsbuildinfo
vendored
File diff suppressed because one or more lines are too long
13
dist/utils/kill-child.js
vendored
13
dist/utils/kill-child.js
vendored
@ -25,23 +25,26 @@ function killChild(childProcess, port) {
|
||||
if (!childProcess)
|
||||
return false;
|
||||
try {
|
||||
const childProcessPID = childProcess.pid;
|
||||
childProcess.kill();
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
try {
|
||||
if (typeof port == "object" && (port === null || port === void 0 ? void 0 : port[0])) {
|
||||
for (let i = 0; i < port.length; i++) {
|
||||
const singlePort = port[i];
|
||||
yield (0, kill_port_1.default)(Number(singlePort), "tcp");
|
||||
}
|
||||
childProcess.kill();
|
||||
return true;
|
||||
}
|
||||
else if (port) {
|
||||
yield (0, kill_port_1.default)(Number(port), "tcp");
|
||||
}
|
||||
}
|
||||
catch (error) { }
|
||||
childProcess.kill();
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
}
|
||||
catch (_err) { }
|
||||
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Child Process couldn't be killed! ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
|
16
dist/utils/start.d.ts
vendored
16
dist/utils/start.d.ts
vendored
@ -1,14 +1,4 @@
|
||||
/**
|
||||
* # Start the process
|
||||
* @param {object} param0
|
||||
* @param {string} param0.command
|
||||
* @param {string[] | string} param0.preflight
|
||||
* @param {string[] | string} [param0.postflight]
|
||||
* @param {string} param0.redeploy_file
|
||||
* @param {string | number | (string | number)[]} [param0.port] - The port to kill on rebuild
|
||||
* @param {boolean} [param0.first_run] - Whether to run the preflight on first run. Default `false`
|
||||
*/
|
||||
export default function startProcess({ command, preflight, postflight, redeploy_file, port, first_run, debounce, }: {
|
||||
type Param = {
|
||||
command: string;
|
||||
preflight?: string[] | string;
|
||||
postflight?: string[] | string;
|
||||
@ -16,4 +6,6 @@ export default function startProcess({ command, preflight, postflight, redeploy_
|
||||
port?: string | number | (string | number)[];
|
||||
first_run?: boolean;
|
||||
debounce?: number;
|
||||
}): void;
|
||||
};
|
||||
export default function startProcess({ command, preflight, postflight, redeploy_file, port, first_run, debounce, }: Param): void;
|
||||
export {};
|
||||
|
10
dist/utils/start.js
vendored
10
dist/utils/start.js
vendored
@ -13,16 +13,6 @@ let childProcess = null;
|
||||
const pTitle = "buncid";
|
||||
process.title = pTitle;
|
||||
let timeout;
|
||||
/**
|
||||
* # Start the process
|
||||
* @param {object} param0
|
||||
* @param {string} param0.command
|
||||
* @param {string[] | string} param0.preflight
|
||||
* @param {string[] | string} [param0.postflight]
|
||||
* @param {string} param0.redeploy_file
|
||||
* @param {string | number | (string | number)[]} [param0.port] - The port to kill on rebuild
|
||||
* @param {boolean} [param0.first_run] - Whether to run the preflight on first run. Default `false`
|
||||
*/
|
||||
function startProcess({ command, preflight, postflight, redeploy_file, port, first_run, debounce, }) {
|
||||
const DEBOUNCE = debounce || 1000;
|
||||
try {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/buncid",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"author": "Benjamin Toby",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -14,25 +14,28 @@ export default async function killChild(
|
||||
if (!childProcess) return false;
|
||||
|
||||
try {
|
||||
const childProcessPID = childProcess.pid;
|
||||
childProcess.kill();
|
||||
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
try {
|
||||
if (typeof port == "object" && port?.[0]) {
|
||||
for (let i = 0; i < port.length; i++) {
|
||||
const singlePort = port[i];
|
||||
await killPort(Number(singlePort), "tcp");
|
||||
}
|
||||
childProcess.kill();
|
||||
return true;
|
||||
} else if (port) {
|
||||
await killPort(Number(port), "tcp");
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
childProcess.kill();
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
}
|
||||
} catch (_err) {}
|
||||
|
||||
console.log(
|
||||
`${colors.FgRed}Error:${colors.Reset} Child Process couldn't be killed! ${error.message}`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,16 @@ process.title = pTitle;
|
||||
|
||||
let timeout: any;
|
||||
|
||||
/**
|
||||
* # Start the process
|
||||
* @param {object} param0
|
||||
* @param {string} param0.command
|
||||
* @param {string[] | string} param0.preflight
|
||||
* @param {string[] | string} [param0.postflight]
|
||||
* @param {string} param0.redeploy_file
|
||||
* @param {string | number | (string | number)[]} [param0.port] - The port to kill on rebuild
|
||||
* @param {boolean} [param0.first_run] - Whether to run the preflight on first run. Default `false`
|
||||
*/
|
||||
type Param = {
|
||||
command: string;
|
||||
preflight?: string[] | string;
|
||||
postflight?: string[] | string;
|
||||
redeploy_file: string;
|
||||
port?: string | number | (string | number)[];
|
||||
first_run?: boolean;
|
||||
debounce?: number;
|
||||
};
|
||||
|
||||
export default function startProcess({
|
||||
command,
|
||||
preflight,
|
||||
@ -30,15 +30,7 @@ export default function startProcess({
|
||||
port,
|
||||
first_run,
|
||||
debounce,
|
||||
}: {
|
||||
command: string;
|
||||
preflight?: string[] | string;
|
||||
postflight?: string[] | string;
|
||||
redeploy_file: string;
|
||||
port?: string | number | (string | number)[];
|
||||
first_run?: boolean;
|
||||
debounce?: number;
|
||||
}) {
|
||||
}: Param) {
|
||||
const DEBOUNCE = debounce || 1000;
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user