2026-05-20 21:39:12 +08:00
|
|
|
/**
|
|
|
|
|
* 在 Windows 上通过 start cmd 打开独立终端窗口分别启动各服务
|
|
|
|
|
*/
|
|
|
|
|
const { exec } = require('child_process')
|
|
|
|
|
|
|
|
|
|
const services = [
|
|
|
|
|
{
|
|
|
|
|
name: '后端',
|
2026-05-21 09:08:59 +08:00
|
|
|
title: 'GPU Guard - 后端 (8003)',
|
|
|
|
|
command: 'pnpm --filter @gpu-guard/backend dev'
|
2026-05-20 21:39:12 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '前端',
|
2026-05-21 09:08:59 +08:00
|
|
|
title: 'GPU Guard - 前端 (9001)',
|
|
|
|
|
command: 'pnpm --filter @gpu-guard/frontend dev'
|
2026-05-20 21:39:12 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '桌面端',
|
2026-05-21 09:08:59 +08:00
|
|
|
title: 'GPU Guard - 桌面端 (Tauri)',
|
|
|
|
|
command: 'pnpm --filter @gpu-guard/desktop dev'
|
2026-05-20 21:39:12 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
console.log('🚀 启动 AI Flow 服务...\n')
|
|
|
|
|
console.log('各服务将在独立终端窗口中运行:')
|
|
|
|
|
console.log(' - 后端: http://localhost:8003')
|
|
|
|
|
console.log(' - 前端: http://localhost:9001')
|
|
|
|
|
console.log(' - 桌面端: Tauri 窗口\n')
|
|
|
|
|
|
|
|
|
|
for (const service of services) {
|
|
|
|
|
// 使用 Windows start 命令在新窗口中运行,/k 保持窗口不关闭
|
|
|
|
|
const cmd = `start cmd /k "title ${service.title} && ${service.command}"`
|
|
|
|
|
console.log(`📦 启动 ${service.name}...`)
|
|
|
|
|
exec(cmd, { shell: 'cmd.exe' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('✅ 所有服务已在新窗口中启动!\n')
|