Updates
This commit is contained in:
parent
0375c02931
commit
69eb6c1128
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"cursor.aipreview.enabled": true
|
||||||
|
}
|
@ -10,9 +10,11 @@ const WORK_DIR = process.cwd();
|
|||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
var REDEPLOYMENTS: number;
|
var REDEPLOYMENTS: number;
|
||||||
|
var DEPLOYING: 0 | 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
global.REDEPLOYMENTS = 0;
|
global.REDEPLOYMENTS = 0;
|
||||||
|
global.DEPLOYING = 0;
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
try {
|
try {
|
||||||
|
1
dist/buncid.d.ts
vendored
1
dist/buncid.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
declare global {
|
declare global {
|
||||||
var REDEPLOYMENTS: number;
|
var REDEPLOYMENTS: number;
|
||||||
|
var DEPLOYING: 0 | 1;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
1
dist/buncid.js
vendored
1
dist/buncid.js
vendored
@ -10,6 +10,7 @@ const console_colors_1 = __importDefault(require("./utils/console-colors"));
|
|||||||
const start_1 = __importDefault(require("./utils/start"));
|
const start_1 = __importDefault(require("./utils/start"));
|
||||||
const WORK_DIR = process.cwd();
|
const WORK_DIR = process.cwd();
|
||||||
global.REDEPLOYMENTS = 0;
|
global.REDEPLOYMENTS = 0;
|
||||||
|
global.DEPLOYING = 0;
|
||||||
function run() {
|
function run() {
|
||||||
try {
|
try {
|
||||||
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");
|
||||||
|
2
dist/tsconfig.tsbuildinfo
vendored
2
dist/tsconfig.tsbuildinfo
vendored
File diff suppressed because one or more lines are too long
13
dist/utils/start.js
vendored
13
dist/utils/start.js
vendored
@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.default = startProcess;
|
exports.default = startProcess;
|
||||||
|
const fs_1 = __importDefault(require("fs"));
|
||||||
const console_colors_1 = __importDefault(require("./console-colors"));
|
const console_colors_1 = __importDefault(require("./console-colors"));
|
||||||
const preflight_1 = __importDefault(require("./preflight"));
|
const preflight_1 = __importDefault(require("./preflight"));
|
||||||
const run_1 = __importDefault(require("./run"));
|
const run_1 = __importDefault(require("./run"));
|
||||||
const kill_child_1 = __importDefault(require("./kill-child"));
|
const kill_child_1 = __importDefault(require("./kill-child"));
|
||||||
const chokidar_1 = __importDefault(require("chokidar"));
|
|
||||||
let childProcess = null;
|
let childProcess = null;
|
||||||
const pTitle = "buncid";
|
const pTitle = "buncid";
|
||||||
process.title = pTitle;
|
process.title = pTitle;
|
||||||
@ -36,14 +36,16 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
|||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
console.log("Watching", redeploy_file);
|
console.log("Watching", redeploy_file);
|
||||||
const watcher = chokidar_1.default.watch(redeploy_file, { ignoreInitial: true });
|
fs_1.default.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
|
||||||
watcher.on("change", (path, stats) => {
|
if (global.DEPLOYING == 1)
|
||||||
|
return;
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
console.log(`${console_colors_1.default.BgBlue}File Changed${console_colors_1.default.Reset}`);
|
console.log(`${console_colors_1.default.BgBlue}File Changed${console_colors_1.default.Reset}`);
|
||||||
if (global.REDEPLOYMENTS == 0) {
|
if (global.REDEPLOYMENTS == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
global.DEPLOYING = 1;
|
||||||
if (childProcess) {
|
if (childProcess) {
|
||||||
console.log("******************************");
|
console.log("******************************");
|
||||||
console.log(`******** ${console_colors_1.default.FgBlue}Rebuilding ${console_colors_1.default.FgMagenta}${global.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} ********`);
|
||||||
@ -60,10 +62,10 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
|||||||
if (postflight) {
|
if (postflight) {
|
||||||
const runPostflight = (0, preflight_1.default)(postflight, true);
|
const runPostflight = (0, preflight_1.default)(postflight, true);
|
||||||
if (!runPostflight) {
|
if (!runPostflight) {
|
||||||
// TODO: Action to take if postflight fails
|
|
||||||
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Postflight Failed.`);
|
console.log(`${console_colors_1.default.FgRed}Error:${console_colors_1.default.Reset} Postflight Failed.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
global.DEPLOYING = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
process.exit();
|
process.exit();
|
||||||
@ -76,6 +78,9 @@ function startProcess({ command, preflight, postflight, redeploy_file, port, fir
|
|||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
global.DEPLOYING = 0;
|
||||||
|
}
|
||||||
}, DEBOUNCE);
|
}, DEBOUNCE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/buncid",
|
"name": "@moduletrace/buncid",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"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": {
|
||||||
@ -22,7 +22,6 @@
|
|||||||
"author": "Benjamin Toby",
|
"author": "Benjamin Toby",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": "^4.0.3",
|
|
||||||
"kill-port": "^2.0.1"
|
"kill-port": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -4,7 +4,6 @@ import colors from "./console-colors";
|
|||||||
import preflightFn from "./preflight";
|
import preflightFn from "./preflight";
|
||||||
import run from "./run";
|
import run from "./run";
|
||||||
import killChild from "./kill-child";
|
import killChild from "./kill-child";
|
||||||
import chokidar from "chokidar";
|
|
||||||
|
|
||||||
let childProcess: ChildProcess | null = null;
|
let childProcess: ChildProcess | null = null;
|
||||||
|
|
||||||
@ -59,9 +58,9 @@ export default function startProcess({
|
|||||||
|
|
||||||
console.log("Watching", redeploy_file);
|
console.log("Watching", redeploy_file);
|
||||||
|
|
||||||
const watcher = chokidar.watch(redeploy_file, { ignoreInitial: true });
|
fs.watchFile(redeploy_file, { interval: 100 }, (curr, prev) => {
|
||||||
|
if (global.DEPLOYING == 1) return;
|
||||||
|
|
||||||
watcher.on("change", (path, stats) => {
|
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
@ -71,6 +70,8 @@ export default function startProcess({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global.DEPLOYING = 1;
|
||||||
|
|
||||||
if (childProcess) {
|
if (childProcess) {
|
||||||
console.log("******************************");
|
console.log("******************************");
|
||||||
console.log(
|
console.log(
|
||||||
@ -97,13 +98,13 @@ export default function startProcess({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!runPostflight) {
|
if (!runPostflight) {
|
||||||
// TODO: Action to take if postflight fails
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`${colors.FgRed}Error:${colors.Reset} Postflight Failed.`
|
`${colors.FgRed}Error:${colors.Reset} Postflight Failed.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global.DEPLOYING = 0;
|
||||||
} else {
|
} else {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
@ -115,6 +116,8 @@ export default function startProcess({
|
|||||||
);
|
);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
global.DEPLOYING = 0;
|
||||||
}
|
}
|
||||||
}, DEBOUNCE);
|
}, DEBOUNCE);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user