The first commit, the core and all files is adding to repo

This commit is contained in:
2026-10-04 14:20:13 +05:00
commit 53d7b263c4
94 changed files with 10668 additions and 0 deletions

37
scripts/supervise.mjs Normal file
View File

@@ -0,0 +1,37 @@
import { spawn } from "node:child_process";
import { existsSync } from "node:fs";
if (existsSync(".env.local")) process.loadEnvFile(".env.local");
const dev = process.argv[2] === "dev";
const children = [];
let stopping = false;
function run(args) {
const c = spawn(process.execPath, args, {
stdio: "inherit",
env: process.env,
});
children.push(c);
c.on("exit", (code) => {
if (!stopping) {
console.error(
`MineGeo process exited (${code}). Shutting down companion process.`,
);
stop(code ?? 1);
}
});
return c;
}
function stop(code = 0) {
if (stopping) return;
stopping = true;
for (const c of children) c.kill("SIGTERM");
setTimeout(() => process.exit(code), 500).unref();
}
process.on("SIGINT", () => stop());
process.on("SIGTERM", () => stop());
run([
"node_modules/next/dist/bin/next",
dev ? "dev" : "start",
"--hostname",
process.env.MINEGEO_HOST || "127.0.0.1",
]);
run(["--import", "tsx", "worker/main.ts"]);