feat(project): init
This commit is contained in:
27
scripts/start-standalone.mjs
Normal file
27
scripts/start-standalone.mjs
Normal file
@@ -0,0 +1,27 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import path from "node:path";
|
||||
import { loadEnvFiles } from "./load-env.mjs";
|
||||
|
||||
loadEnvFiles();
|
||||
|
||||
const serverEntry = path.join(
|
||||
process.cwd(),
|
||||
".next",
|
||||
"standalone",
|
||||
"server.js",
|
||||
);
|
||||
|
||||
const child = spawn(process.execPath, [serverEntry], {
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
child.on("exit", (code, signal) => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
return;
|
||||
}
|
||||
|
||||
process.exit(code ?? 0);
|
||||
});
|
||||
Reference in New Issue
Block a user