cmvr-wms/scripts/projectdev/Start-Local.ps1

24 lines
1.9 KiB
PowerShell
Raw Normal View History

param([ValidateSet('Backend','Frontend','Both')][string]$Component='Both')
$ErrorActionPreference='Stop'
$taskRoot=(Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
$taskTemp=Join-Path $taskRoot '.codex-tmp'
New-Item -ItemType Directory -Path $taskTemp -Force | Out-Null
if ($Component -in @('Backend','Both')) {
if (!(Get-NetTCPConnection -State Listen -LocalPort 8080 -ErrorAction SilentlyContinue)) {
$taskJava=Join-Path $env:USERPROFILE '.jdks/ms-17.0.19/bin/java.exe'
if (!(Test-Path -LiteralPath $taskJava)) { throw 'Configure a Java 17 or newer runtime for this computer.' }
$env:RUOYI_PROFILE=Join-Path $taskTemp 'uploads'
$env:RUOYI_LOG_PATH=Join-Path $taskTemp 'logs'
$taskArgs=@("-Djdk.net.unixdomain.tmpdir=$($taskTemp.Replace('\','/'))",'-Dstdout.encoding=UTF-8','-Dstderr.encoding=UTF-8','-jar','ruoyi-admin/target/cmvr-wms.jar','--spring.quartz.auto-startup=false','--spring.devtools.restart.enabled=false')
Start-Process -FilePath $taskJava -ArgumentList $taskArgs -WorkingDirectory $taskRoot -WindowStyle Hidden -RedirectStandardOutput (Join-Path $taskTemp 'backend.out.log') -RedirectStandardError (Join-Path $taskTemp 'backend.err.log') | Out-Null
}
Write-Output 'Backend: http://localhost:8080 (copied scheduled jobs disabled)'
}
if ($Component -in @('Frontend','Both')) {
if (!(Get-NetTCPConnection -State Listen -LocalPort 8088 -ErrorAction SilentlyContinue)) {
$env:NODE_OPTIONS='--openssl-legacy-provider'
Start-Process -FilePath 'C:/Program Files/nodejs/node.exe' -ArgumentList @('node_modules/@vue/cli-service/bin/vue-cli-service.js','serve','--host','0.0.0.0','--port','8088') -WorkingDirectory (Join-Path $taskRoot 'ruoyi-ui') -WindowStyle Hidden -RedirectStandardOutput (Join-Path $taskTemp 'frontend.out.log') -RedirectStandardError (Join-Path $taskTemp 'frontend.err.log') | Out-Null
}
Write-Output 'Frontend: http://localhost:8088'
}