Updates
This commit is contained in:
parent
619afc8303
commit
1e57cdbc1d
@ -31,6 +31,7 @@ function run() {
|
||||
redeploy_path,
|
||||
first_run,
|
||||
port,
|
||||
debounce,
|
||||
} = config;
|
||||
|
||||
let redeployFile: string | undefined;
|
||||
@ -64,6 +65,7 @@ function run() {
|
||||
first_run,
|
||||
port,
|
||||
postflight,
|
||||
debounce,
|
||||
});
|
||||
} catch (error: any) {
|
||||
console.log(
|
||||
|
3
dist/buncid.js
vendored
3
dist/buncid.js
vendored
@ -14,7 +14,7 @@ function run() {
|
||||
try {
|
||||
const configText = fs_1.default.readFileSync(path_1.default.join(WORK_DIR, "buncid.config.json"), "utf-8");
|
||||
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, debounce, } = config;
|
||||
let redeployFile;
|
||||
if (!redeploy_path) {
|
||||
const defaultRedeployPath = path_1.default.join(WORK_DIR, "REDEPLOY");
|
||||
@ -38,6 +38,7 @@ function run() {
|
||||
first_run,
|
||||
port,
|
||||
postflight,
|
||||
debounce,
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
|
2
dist/tsconfig.tsbuildinfo
vendored
2
dist/tsconfig.tsbuildinfo
vendored
File diff suppressed because one or more lines are too long
1
dist/types.d.ts
vendored
1
dist/types.d.ts
vendored
@ -6,6 +6,7 @@ export interface NodeCIConfig {
|
||||
first_run?: boolean;
|
||||
port?: string | number | (string | number)[];
|
||||
build?: NodeCIBuild;
|
||||
debounce?: number;
|
||||
}
|
||||
export interface NodeCIBuild {
|
||||
paradigm: "Next.JS" | "Remix";
|
||||
|
3
dist/utils/start.d.ts
vendored
3
dist/utils/start.d.ts
vendored
@ -8,11 +8,12 @@
|
||||
* @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, }: {
|
||||
export default function startProcess({ command, preflight, postflight, redeploy_file, 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;
|
||||
}): void;
|
||||
|
7
dist/utils/start.js
vendored
7
dist/utils/start.js
vendored
@ -12,6 +12,7 @@ const kill_child_1 = __importDefault(require("./kill-child"));
|
||||
let childProcess = null;
|
||||
const pTitle = "buncid";
|
||||
process.title = pTitle;
|
||||
let timeout;
|
||||
/**
|
||||
* # Start the process
|
||||
* @param {object} param0
|
||||
@ -22,7 +23,8 @@ process.title = pTitle;
|
||||
* @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, }) {
|
||||
function startProcess({ command, preflight, postflight, redeploy_file, port, first_run, debounce, }) {
|
||||
const DEBOUNCE = debounce || 1000;
|
||||
try {
|
||||
if (first_run) {
|
||||
console.log("First Run ...");
|
||||
@ -35,6 +37,8 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
||||
}
|
||||
console.log("Watching", redeploy_file);
|
||||
fs_1.default.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
console.log(`${console_colors_1.default.BgBlue}File Changed${console_colors_1.default.Reset}`);
|
||||
if (global.REDEPLOYMENTS == 0) {
|
||||
return;
|
||||
@ -71,6 +75,7 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
}, DEBOUNCE);
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/buncid",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Simple CI/CD process For Bun runtime",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
1
types.ts
1
types.ts
@ -6,6 +6,7 @@ export interface NodeCIConfig {
|
||||
first_run?: boolean;
|
||||
port?: string | number | (string | number)[];
|
||||
build?: NodeCIBuild;
|
||||
debounce?: number;
|
||||
}
|
||||
|
||||
export interface NodeCIBuild {
|
||||
|
@ -10,6 +10,8 @@ let childProcess: ChildProcess | null = null;
|
||||
const pTitle = "buncid";
|
||||
process.title = pTitle;
|
||||
|
||||
let timeout: any;
|
||||
|
||||
/**
|
||||
* # Start the process
|
||||
* @param {object} param0
|
||||
@ -27,6 +29,7 @@ export default function startProcess({
|
||||
redeploy_file,
|
||||
port,
|
||||
first_run,
|
||||
debounce,
|
||||
}: {
|
||||
command: string;
|
||||
preflight?: string[] | string;
|
||||
@ -34,7 +37,10 @@ export default function startProcess({
|
||||
redeploy_file: string;
|
||||
port?: string | number | (string | number)[];
|
||||
first_run?: boolean;
|
||||
debounce?: number;
|
||||
}) {
|
||||
const DEBOUNCE = debounce || 1000;
|
||||
|
||||
try {
|
||||
if (first_run) {
|
||||
console.log("First Run ...");
|
||||
@ -53,6 +59,9 @@ export default function startProcess({
|
||||
console.log("Watching", redeploy_file);
|
||||
|
||||
fs.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(() => {
|
||||
console.log(`${colors.BgBlue}File Changed${colors.Reset}`);
|
||||
|
||||
if (global.REDEPLOYMENTS == 0) {
|
||||
@ -104,6 +113,7 @@ export default function startProcess({
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
}, DEBOUNCE);
|
||||
});
|
||||
} catch (error: any) {
|
||||
console.log(
|
||||
|
Loading…
Reference in New Issue
Block a user