- 实现业务确认单条目的移出和恢复功能 - 添加报价匹配明细中的跳过处理选项 - 重构移动应用的环境配置使用默认开发配置 - 更新移动应用Android版本号策略 - 替换到货操作组件为独立的操作组件 - 添加安装配置检查脚本 - 增强测试覆盖包括条目移出恢复和报价跳过场景
37 lines
2.2 KiB
PowerShell
37 lines
2.2 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$taskApp = Split-Path $PSScriptRoot -Parent
|
|
$taskRepo = Split-Path $taskApp -Parent
|
|
$taskDir = Join-Path $taskRepo '.codex-tmp/app-dev-ota'
|
|
$taskServer = Join-Path $PSScriptRoot 'serve-development.mjs'
|
|
$taskConfig = Get-Content -LiteralPath (Join-Path $taskApp 'config/development.json') -Raw | ConvertFrom-Json
|
|
$taskOrigin = $taskConfig.updateOrigin
|
|
New-Item -ItemType Directory -Path $taskDir -Force | Out-Null
|
|
$taskRecord = Join-Path $taskDir 'server.json'
|
|
if (Test-Path -LiteralPath $taskRecord) {
|
|
$taskPrevious = Get-Content -LiteralPath $taskRecord -Raw | ConvertFrom-Json
|
|
$taskExisting = Get-CimInstance Win32_Process -Filter "ProcessId=$($taskPrevious.pid)"
|
|
if ($taskExisting -and $taskExisting.Name -eq 'node.exe' -and $taskExisting.CommandLine.Contains($taskServer) -and $taskPrevious.origin -eq $taskOrigin) {
|
|
if ((Invoke-WebRequest -Uri ($taskOrigin + '/health') -TimeoutSec 5 -UseBasicParsing).Content.Trim() -eq 'ok') {
|
|
Write-Output ('Development updates already running: ' + $taskOrigin)
|
|
exit 0
|
|
}
|
|
}
|
|
if ($taskExisting) { throw 'Recorded process does not match a healthy development update server; no process stopped.' }
|
|
}
|
|
$taskNode = (Get-Command node.exe).Source
|
|
$taskProcess = Start-Process -FilePath $taskNode -ArgumentList ('"' + $taskServer + '"') -WorkingDirectory $taskApp -WindowStyle Hidden -PassThru `
|
|
-RedirectStandardOutput (Join-Path $taskDir 'server.out.log') -RedirectStandardError (Join-Path $taskDir 'server.err.log')
|
|
for ($taskAttempt = 0; $taskAttempt -lt 20; $taskAttempt++) {
|
|
Start-Sleep -Milliseconds 250
|
|
$taskProcess.Refresh()
|
|
if ($taskProcess.HasExited) { throw (Get-Content -LiteralPath (Join-Path $taskDir 'server.err.log') -Raw) }
|
|
try {
|
|
if ((Invoke-WebRequest -Uri ($taskOrigin + '/health') -TimeoutSec 2 -UseBasicParsing).Content.Trim() -eq 'ok') {
|
|
[IO.File]::WriteAllText($taskRecord, (@{pid=$taskProcess.Id;origin=$taskOrigin;script=$taskServer} | ConvertTo-Json))
|
|
Write-Output ('Development updates running: ' + $taskOrigin)
|
|
exit 0
|
|
}
|
|
} catch { }
|
|
}
|
|
throw 'Development update service did not become ready; inspect .codex-tmp/app-dev-ota/server.err.log'
|