Files
daily_publish/start-dev.ps1
T

28 lines
1.0 KiB
PowerShell

# Start dev server for publish project
$ErrorActionPreference = 'Continue'
$logFile = "D:\Idea Project\publish\dev-server.log"
try {
# Start the process using powershell -Command to invoke pnpm
$proc = Start-Process -FilePath "powershell" `
-ArgumentList "-NoExit", "-Command", "cd 'D:\Idea Project\publish'; pnpm run dev" `
-PassThru `
-WindowStyle Minimized
Write-Output "Started process ID: $($proc.Id)"
# Wait for the server to start
Start-Sleep -Seconds 20
# Check if port 41734 is listening
$portCheck = Get-NetTCPConnection -LocalPort 41734 -ErrorAction SilentlyContinue
if ($portCheck) {
Write-Output "SUCCESS: Server is running on port 41734"
} else {
Write-Output "Server not yet on port 41734, checking all ports..."
Get-NetTCPConnection -State Listen | Where-Object { $_.LocalPort -ge 41000 -and $_.LocalPort -le 42000 } | Select-Object LocalPort
}
} catch {
Write-Output "Error: $($_.Exception.Message)"
}