Files
miniSCP/scripts/dev.ts
T
JokinandClaude Fable 5 8092cb0c08 P0: Electrobun + Angular 22 + Tailwind skeleton boots under Bun
- Electrobun 1.18 shell with branding in src/shared/branding.ts
- Angular 22 zoneless UI in ui/ (workspace), Tailwind v4 shadcn-style tokens
- ng-icons/mynaui icon registry
- Node-version shim so Angular CLI runs under Bun without Node installed
- ssh2 SFTP verified working under Bun against test box

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 13:23:15 +02:00

43 lines
1.1 KiB
TypeScript

// Dev orchestrator: starts ng serve (UI hot reload), waits for it, then runs
// `electrobun dev --watch` (relaunches the app when bun-side code changes).
const DEV_SERVER_URL = "http://localhost:4200";
const ui = Bun.spawn(["bun", "run", "--cwd", "ui", "start"], {
stdout: "inherit",
stderr: "inherit",
});
async function waitForServer(url: string, timeoutMs = 90_000): Promise<void> {
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
try {
await fetch(url, { method: "HEAD" });
return;
} catch {
await Bun.sleep(300);
}
}
throw new Error(`Dev server at ${url} did not come up in ${timeoutMs}ms`);
}
console.log(`Waiting for Angular dev server at ${DEV_SERVER_URL} ...`);
await waitForServer(DEV_SERVER_URL);
console.log("Angular dev server is up, launching Electrobun ...");
const app = Bun.spawn(["bunx", "electrobun", "dev", "--watch"], {
stdout: "inherit",
stderr: "inherit",
env: { ...process.env, DEV_SERVER_URL },
});
function shutdown() {
ui.kill();
app.kill();
process.exit(0);
}
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);
await app.exited;
shutdown();