Files
NODEDC_MISSION_CORE/simulation/ai-polygon/Prepare-SplatTools.ps1
T

20 lines
1.0 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$root = 'D:\NDC_MISSIONCORE\runtime\simulation\tools\splat-transform-3.4.0'
$source = Join-Path $PSScriptRoot 'splat-tools'
if ([int]((& node.exe --version).TrimStart('v').Split('.')[0]) -lt 22) { throw 'Node 22 or newer required' }
New-Item -ItemType Directory $root -Force | Out-Null
foreach ($name in @('package.json', 'package-lock.json')) {
$target = Join-Path $root $name
if (Test-Path $target) {
if ((Get-FileHash $target).Hash -ne (Get-FileHash (Join-Path $source $name)).Hash) { throw 'Splat tools definition changed' }
} else { Copy-Item (Join-Path $source $name) $target }
}
Push-Location $root
try {
& npm.cmd ci --ignore-scripts --no-audit --no-fund --cache "$root\npm-cache"
if ($LASTEXITCODE -ne 0) { throw 'Splat tools preparation failed' }
& node.exe "$root\node_modules\@playcanvas\splat-transform\bin\cli.mjs" --version
if ($LASTEXITCODE -ne 0) { throw 'Splat tools validation failed' }
} finally { Pop-Location }