Addressed Staging Freshness Testing & Fixed Page Title, Subtitle, and Icon Missing Issues

This commit is contained in:
2025-11-26 19:37:45 -07:00
parent c5428c06b1
commit f8d0cae7ee
3 changed files with 73 additions and 6 deletions

View File

@@ -270,6 +270,41 @@ function Ensure-EngineWebInterface {
}
}
function Get-WebUiLatestWriteTime {
param([string]$Root)
if (-not (Test-Path $Root)) { return $null }
$exclusions = @('\node_modules\', '\build\', '\dist\')
$files = Get-ChildItem -Path $Root -Recurse -File -ErrorAction SilentlyContinue | Where-Object {
$full = $_.FullName
-not ($exclusions | Where-Object { $full -like "*$_*" })
}
if (-not $files) { return $null }
return ($files | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1).LastWriteTime
}
function Test-WebUiBuildFresh {
param(
[string]$SourceRoot,
[string]$BuildRoot
)
$sourceLatest = Get-WebUiLatestWriteTime -Root $SourceRoot
if (-not $sourceLatest) { return $false }
$buildIndex = Join-Path $BuildRoot 'index.html'
if (-not (Test-Path $buildIndex -PathType Leaf)) { return $false }
try {
$buildTime = (Get-Item $buildIndex -ErrorAction Stop).LastWriteTime
} catch {
return $false
}
return ($buildTime -ge $sourceLatest)
}
$script:Utf8CodePageChanged = $false
function Ensure-SystemUtf8CodePage {
@@ -1184,6 +1219,16 @@ switch ($choice) {
}
}
if ($engineImmediateLaunch) {
$webUiSourceRoot = Join-Path $scriptDir 'Data\Engine\web-interface'
$webUiBuildRoot = Join-Path $scriptDir 'Engine\web-interface\build'
$webUiFresh = Test-WebUiBuildFresh -SourceRoot $webUiSourceRoot -BuildRoot $webUiBuildRoot
if (-not $webUiFresh) {
Write-Host "Detected WebUI changes newer than the last production build. Running full build instead of Quick/Skip." -ForegroundColor Yellow
$engineImmediateLaunch = $false
}
}
if ($engineModeChoice -notin @('1','2','3')) {
break
}