param([ValidateSet('Backend','Frontend','Both')][string]$Component='Both',[switch]$RealDataReplay,[switch]$HistoryEntry,[string]$HistorySource='',[switch]$Restart) $ErrorActionPreference='Stop' $taskRoot=(Resolve-Path (Join-Path $PSScriptRoot '../..')).Path $taskIdentity=[Security.Principal.WindowsIdentity]::GetCurrent() $taskPrincipal=New-Object Security.Principal.WindowsPrincipal($taskIdentity) if($taskPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){throw 'Run local development from a normal PowerShell window, not Administrator mode.'} $taskTemp=Join-Path $taskRoot '.codex-tmp' New-Item -ItemType Directory -Path $taskTemp -Force | Out-Null if ($Component -in @('Backend','Both')) { & (Join-Path $PSScriptRoot 'Backend-Local.ps1') -Action $(if($Restart){'Restart'}else{'Start'}) -RealDataReplay:$RealDataReplay -HistoryEntry:$HistoryEntry -HistorySource $HistorySource } if ($Component -in @('Frontend','Both')) { if (!(Get-NetTCPConnection -State Listen -LocalPort 8088 -ErrorAction SilentlyContinue)) { $env:NODE_OPTIONS='--max-old-space-size=2048' Start-Process -FilePath 'C:/Program Files/nodejs/node.exe' -ArgumentList @('node_modules/vite/bin/vite.js','--host','0.0.0.0','--port','8088') -WorkingDirectory (Join-Path $taskRoot 'ruoyi-ui-vue3') -WindowStyle Hidden -RedirectStandardOutput (Join-Path $taskTemp 'frontend.out.log') -RedirectStandardError (Join-Path $taskTemp 'frontend.err.log') | Out-Null } Write-Output 'Frontend Vue3: http://localhost:8088 (ruoyi-ui-vue3)' }