islandflow/apps/web/scripts/dev.ts
dirtydishes 18366192b2 Bind web dev server to port 3000
Simplify the web dev launcher to always use port 3000 and fix the dev:web script cwd invocation.
2025-12-29 18:42:01 -05:00

32 lines
669 B
TypeScript

const run = async () => {
const port = 3000;
console.log(`[web] starting Next.js dev server on port ${port}`);
const path = Bun.env.PATH ?? "";
const cwd = `${import.meta.dir}/..`;
const child = Bun.spawn(["next", "dev", "-p", String(port)], {
cwd,
stdin: "inherit",
stdout: "inherit",
stderr: "inherit",
env: {
...Bun.env,
PATH: `${cwd}/node_modules/.bin:${path}`,
PORT: String(port)
}
});
const shutdown = () => {
child.kill();
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);
const code = await child.exited;
process.exit(code ?? 0);
};
await run();