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)
|
if (!childProcess)
|
||||||
return false;
|
return false;
|
||||||
try {
|
try {
|
||||||
const childProcessPID = childProcess.pid;
|
|
||||||
childProcess.kill();
|
childProcess.kill();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
try {
|
try {
|
||||||
if (typeof port == "object" && (port === null || port === void 0 ? void 0 : port[0])) {
|
if (typeof port == "object" && (port === null || port === void 0 ? void 0 : port[0])) {
|
||||||
for (let i = 0; i < port.length; i++) {
|
for (let i = 0; i < port.length; i++) {
|
||||||
const singlePort = port[i];
|
const singlePort = port[i];
|
||||||
yield (0, kill_port_1.default)(Number(singlePort), "tcp");
|
yield (0, kill_port_1.default)(Number(singlePort), "tcp");
|
||||||
}
|
}
|
||||||
|
childProcess.kill();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (port) {
|
else if (port) {
|
||||||
yield (0, kill_port_1.default)(Number(port), "tcp");
|
yield (0, kill_port_1.default)(Number(port), "tcp");
|
||||||
}
|
childProcess.kill();
|
||||||
}
|
|
||||||
catch (error) { }
|
|
||||||
return true;
|
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}`);
|
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Child Process couldn't be killed! ${error.message}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
16
dist/utils/start.d.ts
vendored
16
dist/utils/start.d.ts
vendored
@ -1,14 +1,4 @@
|
|||||||
/**
|
type Param = {
|
||||||
* # 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, }: {
|
|
||||||
command: string;
|
command: string;
|
||||||
preflight?: string[] | string;
|
preflight?: string[] | string;
|
||||||
postflight?: string[] | string;
|
postflight?: string[] | string;
|
||||||
@ -16,4 +6,6 @@ export default function startProcess({ command, preflight, postflight, redeploy_
|
|||||||
port?: string | number | (string | number)[];
|
port?: string | number | (string | number)[];
|
||||||
first_run?: boolean;
|
first_run?: boolean;
|
||||||
debounce?: number;
|
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";
|
const pTitle = "buncid";
|
||||||
process.title = pTitle;
|
process.title = pTitle;
|
||||||
let timeout;
|
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, }) {
|
function startProcess({ command, preflight, postflight, redeploy_file, port, first_run, debounce, }) {
|
||||||
const DEBOUNCE = debounce || 1000;
|
const DEBOUNCE = debounce || 1000;
|
||||||
try {
|
try {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/buncid",
|
"name": "@moduletrace/buncid",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"author": "Benjamin Toby",
|
"author": "Benjamin Toby",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -14,25 +14,28 @@ export default async function killChild(
|
|||||||
if (!childProcess) return false;
|
if (!childProcess) return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const childProcessPID = childProcess.pid;
|
|
||||||
childProcess.kill();
|
childProcess.kill();
|
||||||
|
return true;
|
||||||
|
} catch (error: any) {
|
||||||
try {
|
try {
|
||||||
if (typeof port == "object" && port?.[0]) {
|
if (typeof port == "object" && port?.[0]) {
|
||||||
for (let i = 0; i < port.length; i++) {
|
for (let i = 0; i < port.length; i++) {
|
||||||
const singlePort = port[i];
|
const singlePort = port[i];
|
||||||
await killPort(Number(singlePort), "tcp");
|
await killPort(Number(singlePort), "tcp");
|
||||||
}
|
}
|
||||||
|
childProcess.kill();
|
||||||
|
return true;
|
||||||
} else if (port) {
|
} else if (port) {
|
||||||
await killPort(Number(port), "tcp");
|
await killPort(Number(port), "tcp");
|
||||||
}
|
childProcess.kill();
|
||||||
} catch (error) {}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error: any) {
|
}
|
||||||
|
} catch (_err) {}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`${colors.FgRed}Error:${colors.Reset} Child Process couldn't be killed! ${error.message}`
|
`${colors.FgRed}Error:${colors.Reset} Child Process couldn't be killed! ${error.message}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,16 @@ process.title = pTitle;
|
|||||||
|
|
||||||
let timeout: any;
|
let timeout: any;
|
||||||
|
|
||||||
/**
|
type Param = {
|
||||||
* # Start the process
|
command: string;
|
||||||
* @param {object} param0
|
preflight?: string[] | string;
|
||||||
* @param {string} param0.command
|
postflight?: string[] | string;
|
||||||
* @param {string[] | string} param0.preflight
|
redeploy_file: string;
|
||||||
* @param {string[] | string} [param0.postflight]
|
port?: string | number | (string | number)[];
|
||||||
* @param {string} param0.redeploy_file
|
first_run?: boolean;
|
||||||
* @param {string | number | (string | number)[]} [param0.port] - The port to kill on rebuild
|
debounce?: number;
|
||||||
* @param {boolean} [param0.first_run] - Whether to run the preflight on first run. Default `false`
|
};
|
||||||
*/
|
|
||||||
export default function startProcess({
|
export default function startProcess({
|
||||||
command,
|
command,
|
||||||
preflight,
|
preflight,
|
||||||
@ -30,15 +30,7 @@ export default function startProcess({
|
|||||||
port,
|
port,
|
||||||
first_run,
|
first_run,
|
||||||
debounce,
|
debounce,
|
||||||
}: {
|
}: Param) {
|
||||||
command: string;
|
|
||||||
preflight?: string[] | string;
|
|
||||||
postflight?: string[] | string;
|
|
||||||
redeploy_file: string;
|
|
||||||
port?: string | number | (string | number)[];
|
|
||||||
first_run?: boolean;
|
|
||||||
debounce?: number;
|
|
||||||
}) {
|
|
||||||
const DEBOUNCE = debounce || 1000;
|
const DEBOUNCE = debounce || 1000;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user