feat(dev): auto-switch ports on dev:all when defaults are busy

Adds a small launcher (scripts/dev-all.mjs) that probes free ports
for the daemon (OD_PORT, default 7456) and Vite (VITE_PORT, default
5173) before invoking concurrently, so a stray process holding
either port no longer breaks the boot. The resolved ports are
exported into the child env; vite.config.ts now reads VITE_PORT to
keep its dev server and /api proxy aligned with the daemon's actual
port.

Made-with: Cursor
This commit is contained in:
pftom
2026-04-28 22:19:42 +08:00
parent 5a63d09f2f
commit 89d92d8ae0
3 changed files with 87 additions and 2 deletions
+2 -1
View File
@@ -2,11 +2,12 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
const DAEMON_PORT = Number(process.env.OD_PORT) || 7456;
const VITE_PORT = Number(process.env.VITE_PORT) || 5173;
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
port: VITE_PORT,
proxy: {
'/api': {
target: `http://127.0.0.1:${DAEMON_PORT}`,