This commit is contained in:
Rizky 2024-01-25 13:51:36 +07:00
parent eeb64e5008
commit 8876b86d8f
1 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,8 @@
import { Subprocess } from "bun"; import { Subprocess } from "bun";
import { $ } from "execa";
import exitHook from "exit-hook"; import exitHook from "exit-hook";
import { existsAsync } from "fs-jetpack";
import { dir } from "utils/dir";
import { checkPort, randomBetween } from "utils/ensure"; import { checkPort, randomBetween } from "utils/ensure";
let port = 0; let port = 0;
@ -32,6 +35,14 @@ const main = {
console.log("Process Manager running at port:", port); console.log("Process Manager running at port:", port);
if (await existsAsync(dir("app/db/.env"))) {
if (!(await existsAsync(dir("node_modules/.prisma")))) {
await $({ cwd: dir(`app/db`) })`bun install`;
await $({ cwd: dir(`app/db`) })`bun prisma db pull`;
await $({ cwd: dir(`app/db`) })`bun prisma generate`;
}
}
const startMain = () => { const startMain = () => {
let mode = "started"; let mode = "started";
if (main.process && !main.process.killed) return; if (main.process && !main.process.killed) return;