Rebuild Mode1Svelte with SvelteKit + Node.js adapter
- Migrated from Bun/Hono to modern SvelteKit tech stack - Implemented complete authentication module (Azure MSAL + PocketBase) - Created 5 API endpoints for auth operations (config, graph token, validate, refresh, compare) - Built interactive Svelte dashboard with mobile optimization (iPhone 16) - Added Node.js adapter (@sveltejs/adapter-node) for production deployment - Integrated Tailwind CSS with responsive design - Fixed orchestrator to spawn Mode1Svelte with Node.js on port 3005 - Updated systemd service (job-info-test.service) to start orchestrator on port 3006 - Port configuration locked: 3005 = Mode1Svelte, 3006 = Orchestrator - Full TypeScript type safety throughout application - Services auto-managed by orchestrator with systemd integration
This commit is contained in:
@@ -82,20 +82,40 @@ async function startMode(mode: string): Promise<boolean> {
|
||||
|
||||
console.log(`[ModeSwitch] Starting ${mode} (${folderName}/) on port ${SHARED_PORT}...`);
|
||||
|
||||
// Determine server path - all modes use backend/server.ts
|
||||
const serverPath = 'backend/server.ts';
|
||||
// Mode1Svelte uses Node.js adapter with build/index.js
|
||||
if (mode === 'Mode1Svelte') {
|
||||
const buildPath = `${modePath}/build`;
|
||||
if (!fs.existsSync(buildPath)) {
|
||||
console.error(`Build directory not found for Mode1Svelte. Run: cd ${modePath} && npm run build`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start the mode's backend server
|
||||
currentProcess = Bun.spawn({
|
||||
cmd: [process.execPath, 'run', serverPath],
|
||||
cwd: modePath,
|
||||
env: {
|
||||
...process.env, // Inherit all env vars (secrets, etc.)
|
||||
PORT: String(SHARED_PORT), // Force mode service to bind to shared port
|
||||
},
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
});
|
||||
// Start with Node.js
|
||||
currentProcess = Bun.spawn({
|
||||
cmd: ['node', 'build/index.js'],
|
||||
cwd: modePath,
|
||||
env: {
|
||||
...process.env,
|
||||
PORT: String(SHARED_PORT),
|
||||
},
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
});
|
||||
} else {
|
||||
// Other modes (Mode1, Mode6Test) use Bun with backend/server.ts
|
||||
const serverPath = 'backend/server.ts';
|
||||
|
||||
currentProcess = Bun.spawn({
|
||||
cmd: [process.execPath, 'run', serverPath],
|
||||
cwd: modePath,
|
||||
env: {
|
||||
...process.env,
|
||||
PORT: String(SHARED_PORT),
|
||||
},
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
});
|
||||
}
|
||||
|
||||
currentMode = mode;
|
||||
writeActiveMode(mode);
|
||||
|
||||
Reference in New Issue
Block a user