-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.ts
More file actions
52 lines (43 loc) · 1.38 KB
/
dev.ts
File metadata and controls
52 lines (43 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Development script that runs Presidio, API, and UI servers concurrently
*/
import { spawn } from 'bun'
import { join } from 'node:path'
console.log('Starting development servers...\n')
// Path to Presidio Python executable
const presidioPath = join(import.meta.dir, 'presidio-backend')
const pythonExe = join(presidioPath, 'Scripts', 'python.exe')
const presidioScript = join(presidioPath, 'presidio_server.py')
// Start Presidio backend
console.log('[DEV] Starting Presidio backend on port 5050...')
const presidio = spawn({
cmd: [pythonExe, presidioScript],
stdout: 'inherit',
stderr: 'inherit',
})
// Wait a bit for Presidio to initialize before starting Bun servers
await new Promise(resolve => setTimeout(resolve, 6000))
console.log('[DEV] Presidio initialized, starting Bun servers...\n')
// Start API server on port 3001 for dev mode
const api = spawn({
cmd: ['bun', '--hot', 'packages/api/server.ts'],
stdout: 'inherit',
stderr: 'inherit',
env: { ...process.env, PORT: '3001' },
})
// Start UI server
const ui = spawn({
cmd: ['bun', '--hot', 'packages/ui/index.html'],
stdout: 'inherit',
stderr: 'inherit',
})
// Handle process termination
process.on('SIGINT', () => {
console.log('\n[DEV] Shutting down all servers...')
presidio.kill()
api.kill()
ui.kill()
process.exit(0)
})
// Wait for all processes
await Promise.all([presidio.exited, api.exited, ui.exited])