nomadweb/scripts/dev.ps1
2026-08-28 19:49:10 -05:00

33 lines
1.0 KiB
PowerShell

# NomadFlow 本地开发启动脚本 (Windows PowerShell)
# 用法: .\scripts\dev.ps1
Write-Host "🌍 NomadFlow 开发环境启动" -ForegroundColor Cyan
# 检查后端依赖
if (-not (Test-Path "backend\.venv")) {
Write-Host "📦 创建 Python 虚拟环境..." -ForegroundColor Yellow
python -m venv backend\.venv
& backend\.venv\Scripts\pip install -r backend\requirements.txt -q
}
# 启动后端
Write-Host "🚀 启动 FastAPI (http://localhost:8000)..." -ForegroundColor Green
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd backend; .\.venv\Scripts\activate; uvicorn app.main:app --reload --port 8000"
Start-Sleep -Seconds 2
# 启动前端
Write-Host "🌐 启动 Next.js (http://localhost:3000)..." -ForegroundColor Green
if (-not (Test-Path "frontend\node_modules\next")) {
Write-Host "📦 安装前端依赖..." -ForegroundColor Yellow
Set-Location frontend
npm install
Set-Location ..
}
Set-Location frontend
if (-not (Test-Path ".env.local")) {
Copy-Item ".env.local.example" ".env.local"
}
npm run dev