From d345e60a6aa8233646c962d66777d0abbe8cd3d7 Mon Sep 17 00:00:00 2001 From: iven Date: Mon, 30 Mar 2026 09:44:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20start-all.ps1=20=E9=80=82?= =?UTF-8?q?=E9=85=8D=20admin-v2=20(Vite=20port=205173)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Admin 从 Next.js (port 3000) 迁移到 Vite (port 5173), 更新启动/停止/清理逻辑,保留旧端口 3000-3002 的 legacy 清理。 --- start-all.ps1 | 73 +++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/start-all.ps1 b/start-all.ps1 index 7f41fd3..ee5bda2 100644 --- a/start-all.ps1 +++ b/start-all.ps1 @@ -1,5 +1,5 @@ # 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. # 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) $port4200 = netstat -ano | Select-String ":4200.*LISTENING" 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 Get-Process -Name "ZClaw" -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) - foreach ($port in @(8080, 3000, 3001, 3002)) { + # Fallback: kill ALL processes on service ports (5173 = Admin V2 Vite) + foreach ($port in @(8080, 5173)) { $listening = netstat -ano | Select-String ":${port}.*LISTENING" if ($listening) { $pid = ($listening -split '\s+')[-1] @@ -254,36 +263,36 @@ if (-not $NoSaas) { 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) { - info "Checking Admin dashboard..." + info "Checking Admin V2 dashboard..." - $port3000 = netstat -ano | Select-String ":3000.*LISTENING" - if ($port3000) { - $pid3000 = ($port3000 -split '\s+')[-1] - if ($pid3000 -match '^\d+$') { - ok "Admin dashboard already running on port 3000 (PID: $pid3000)" + $port5173 = netstat -ano | Select-String ":5173.*LISTENING" + if ($port5173) { + $pid5173 = ($port5173 -split '\s+')[-1] + if ($pid5173 -match '^\d+$') { + ok "Admin V2 already running on port 5173 (PID: $pid5173)" } } else { - if (Test-Path "$ScriptDir\admin\package.json") { - info "Starting Admin dashboard on port 3000..." + if (Test-Path "$ScriptDir\admin-v2\package.json") { + 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 Start-Sleep -Seconds 5 - $port3000Check = netstat -ano | Select-String ":3000.*LISTENING" - if ($port3000Check) { - ok "Admin dashboard started on port 3000 (PID: $($proc.Id))" + $port5173Check = netstat -ano | Select-String ":5173.*LISTENING" + if ($port5173Check) { + ok "Admin V2 started on port 5173 (PID: $($proc.Id))" } else { - warn "Admin dashboard may still be starting. Check http://localhost:3000" + warn "Admin V2 may still be starting. Check http://localhost:5173" } } else { - warn "Admin directory not found. Skipping." + warn "admin-v2 directory not found. Skipping." } } } else { - info "Skipping Admin dashboard" + info "Skipping Admin V2 dashboard" } Write-Host ""