this repo has no description
1#!/usr/bin/env bun
2/**
3 * Development server - runs API + Vite with hot reload
4 * Usage: bun run scripts/dev.ts
5 */
6
7import { spawn } from 'bun';
8
9console.log('Starting development servers...\n');
10
11// Start API server
12const api = spawn({
13 cmd: ['bun', 'run', 'src/cli/index.ts', 'serve'],
14 stdout: 'inherit',
15 stderr: 'inherit',
16 env: { ...process.env, FORCE_COLOR: '1' },
17});
18
19// Give API a moment to start
20await Bun.sleep(500);
21
22// Start Vite dev server
23const vite = spawn({
24 cmd: ['bunx', 'vite', '--host'],
25 stdout: 'inherit',
26 stderr: 'inherit',
27 env: { ...process.env, FORCE_COLOR: '1' },
28});
29
30console.log('\n📡 API server: http://localhost:3456');
31console.log('🔥 Dev server: http://localhost:5173 (use this one)\n');
32
33// Handle cleanup
34process.on('SIGINT', () => {
35 api.kill();
36 vite.kill();
37 process.exit(0);
38});
39
40process.on('SIGTERM', () => {
41 api.kill();
42 vite.kill();
43 process.exit(0);
44});
45
46// Wait for both
47await Promise.all([api.exited, vite.exited]);