mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
Fix execution workspace runtime lifecycle
This commit is contained in:
parent
7a06a577ce
commit
3b25268c0b
7 changed files with 553 additions and 10 deletions
|
|
@ -30,6 +30,13 @@ import type { BetterAuthSessionResult } from "./auth/better-auth.js";
|
|||
|
||||
type UiMode = "none" | "static" | "vite-dev";
|
||||
|
||||
export function resolveViteHmrPort(serverPort: number): number {
|
||||
if (serverPort <= 55_535) {
|
||||
return serverPort + 10_000;
|
||||
}
|
||||
return Math.max(1_024, serverPort - 10_000);
|
||||
}
|
||||
|
||||
export async function createApp(
|
||||
db: Db,
|
||||
opts: {
|
||||
|
|
@ -150,7 +157,7 @@ export async function createApp(
|
|||
|
||||
if (opts.uiMode === "vite-dev") {
|
||||
const uiRoot = path.resolve(__dirname, "../../ui");
|
||||
const hmrPort = opts.serverPort + 10000;
|
||||
const hmrPort = resolveViteHmrPort(opts.serverPort);
|
||||
const { createServer: createViteServer } = await import("vite");
|
||||
const vite = await createViteServer({
|
||||
root: uiRoot,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue