prasi-srv/internal/server/start.ts

21 lines
485 B
TypeScript

import { fs } from "utils/fs";
import { g } from "utils/global";
import { spawn } from "utils/spawn";
export const startServer = (arg: { mode: "dev" | "prod" }) => {
if (g.mode === "supervisor") {
g.supervisor = {
process: spawn({
cmd:
arg.mode === "dev"
? "bun run --watch server.js"
: "bun run server.js",
cwd: fs.path("site:app"),
mode: "passthrough",
}),
};
} else {
import("./server");
}
};