fix(scripts): start-all.ps1 适配 admin-v2 (Vite port 5173)
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Admin 从 Next.js (port 3000) 迁移到 Vite (port 5173), 更新启动/停止/清理逻辑,保留旧端口 3000-3002 的 legacy 清理。
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# ZCLAW Full Stack Start Script
|
# ZCLAW Full Stack Start Script
|
||||||
# Starts: PostgreSQL (Docker) -> SaaS Backend -> Admin Web -> ChromeDriver (optional) -> Tauri Desktop
|
# Starts: PostgreSQL (Docker) -> SaaS Backend -> Admin V2 (Vite) -> ChromeDriver (optional) -> Tauri Desktop
|
||||||
#
|
#
|
||||||
# NOTE: ZCLAW now uses internal Kernel (zclaw-kernel) for all operations.
|
# NOTE: ZCLAW now uses internal Kernel (zclaw-kernel) for all operations.
|
||||||
# No external ZCLAW runtime is required.
|
# No external ZCLAW runtime is required.
|
||||||
@@ -73,6 +73,28 @@ if ($Stop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Stop Admin V2 dev server (Vite on port 5173)
|
||||||
|
$port5173 = netstat -ano | Select-String ":5173.*LISTENING"
|
||||||
|
if ($port5173) {
|
||||||
|
$pid5173 = ($port5173 -split '\s+')[-1]
|
||||||
|
if ($pid5173 -match '^\d+$') {
|
||||||
|
& taskkill /T /F /PID $pid5173 2>$null
|
||||||
|
ok "Stopped Admin V2 process on port 5173 (PID: $pid5173)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stop any legacy Next.js admin on ports 3000-3002
|
||||||
|
foreach ($adminPort in @(3000, 3001, 3002)) {
|
||||||
|
$portMatch = netstat -ano | Select-String ":${adminPort}.*LISTENING"
|
||||||
|
if ($portMatch) {
|
||||||
|
$adminPid = ($portMatch -split '\s+')[-1]
|
||||||
|
if ($adminPid -match '^\d+$') {
|
||||||
|
& taskkill /T /F /PID $adminPid 2>$null
|
||||||
|
ok "Stopped legacy Admin process on port $adminPort (PID: $adminPid)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Stop any process on port 4200 (legacy, may still be in use)
|
# Stop any process on port 4200 (legacy, may still be in use)
|
||||||
$port4200 = netstat -ano | Select-String ":4200.*LISTENING"
|
$port4200 = netstat -ano | Select-String ":4200.*LISTENING"
|
||||||
if ($port4200) {
|
if ($port4200) {
|
||||||
@@ -83,19 +105,6 @@ if ($Stop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop Admin dev server (kill process tree to ensure node.exe children die)
|
|
||||||
# Next.js turbopack may use ports 3000-3002
|
|
||||||
foreach ($adminPort in @(3000, 3001, 3002)) {
|
|
||||||
$portMatch = netstat -ano | Select-String ":${adminPort}.*LISTENING"
|
|
||||||
if ($portMatch) {
|
|
||||||
$adminPid = ($portMatch -split '\s+')[-1]
|
|
||||||
if ($adminPid -match '^\d+$') {
|
|
||||||
& taskkill /T /F /PID $adminPid 2>$null
|
|
||||||
ok "Stopped Admin process on port $adminPort (PID: $adminPid)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Stop Tauri/ZClaw
|
# Stop Tauri/ZClaw
|
||||||
Get-Process -Name "ZClaw" -ErrorAction SilentlyContinue | Stop-Process -Force
|
Get-Process -Name "ZClaw" -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||||
Get-Process -Name "desktop" -ErrorAction SilentlyContinue | Stop-Process -Force
|
Get-Process -Name "desktop" -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||||
@@ -144,8 +153,8 @@ function Cleanup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fallback: kill ALL processes on service ports (3000-3002 = Next.js + turbopack)
|
# Fallback: kill ALL processes on service ports (5173 = Admin V2 Vite)
|
||||||
foreach ($port in @(8080, 3000, 3001, 3002)) {
|
foreach ($port in @(8080, 5173)) {
|
||||||
$listening = netstat -ano | Select-String ":${port}.*LISTENING"
|
$listening = netstat -ano | Select-String ":${port}.*LISTENING"
|
||||||
if ($listening) {
|
if ($listening) {
|
||||||
$pid = ($listening -split '\s+')[-1]
|
$pid = ($listening -split '\s+')[-1]
|
||||||
@@ -254,36 +263,36 @@ if (-not $NoSaas) {
|
|||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
# 3. Admin Web (Next.js management dashboard on port 3000)
|
# 3. Admin V2 (Vite + Ant Design Pro on port 5173)
|
||||||
if (-not $NoSaas) {
|
if (-not $NoSaas) {
|
||||||
info "Checking Admin dashboard..."
|
info "Checking Admin V2 dashboard..."
|
||||||
|
|
||||||
$port3000 = netstat -ano | Select-String ":3000.*LISTENING"
|
$port5173 = netstat -ano | Select-String ":5173.*LISTENING"
|
||||||
if ($port3000) {
|
if ($port5173) {
|
||||||
$pid3000 = ($port3000 -split '\s+')[-1]
|
$pid5173 = ($port5173 -split '\s+')[-1]
|
||||||
if ($pid3000 -match '^\d+$') {
|
if ($pid5173 -match '^\d+$') {
|
||||||
ok "Admin dashboard already running on port 3000 (PID: $pid3000)"
|
ok "Admin V2 already running on port 5173 (PID: $pid5173)"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Test-Path "$ScriptDir\admin\package.json") {
|
if (Test-Path "$ScriptDir\admin-v2\package.json") {
|
||||||
info "Starting Admin dashboard on port 3000..."
|
info "Starting Admin V2 on port 5173..."
|
||||||
|
|
||||||
$proc = Start-Process -FilePath "cmd.exe" -ArgumentList "/c cd /d `"$ScriptDir\admin`" && pnpm dev" -PassThru -WindowStyle Minimized
|
$proc = Start-Process -FilePath "cmd.exe" -ArgumentList "/c cd /d `"$ScriptDir\admin-v2`" && pnpm dev" -PassThru -WindowStyle Minimized
|
||||||
$Jobs += $proc
|
$Jobs += $proc
|
||||||
Start-Sleep -Seconds 5
|
Start-Sleep -Seconds 5
|
||||||
|
|
||||||
$port3000Check = netstat -ano | Select-String ":3000.*LISTENING"
|
$port5173Check = netstat -ano | Select-String ":5173.*LISTENING"
|
||||||
if ($port3000Check) {
|
if ($port5173Check) {
|
||||||
ok "Admin dashboard started on port 3000 (PID: $($proc.Id))"
|
ok "Admin V2 started on port 5173 (PID: $($proc.Id))"
|
||||||
} else {
|
} else {
|
||||||
warn "Admin dashboard may still be starting. Check http://localhost:3000"
|
warn "Admin V2 may still be starting. Check http://localhost:5173"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn "Admin directory not found. Skipping."
|
warn "admin-v2 directory not found. Skipping."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info "Skipping Admin dashboard"
|
info "Skipping Admin V2 dashboard"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|||||||
Reference in New Issue
Block a user