<# .SYNOPSIS Builds the FileMaker reader (fmptools) to WebAssembly in Docker and copies it to frontend/vendor/local/fmptools@2/, where the site serves it from /vendor/. fmptools is pinned by commit in the Dockerfile; the exact sources built are copied into source/ beside these files, so they are published at /source/fmptools/ with them. Nothing is installed on this machine; Docker Desktop must be running. #> $ErrorActionPreference = 'Continue' Set-Location $PSScriptRoot $dist = Join-Path $PSScriptRoot 'dist' if (Test-Path $dist) { Remove-Item -Recurse -Force $dist } & docker build --target export --output "type=local,dest=$dist" . if ($LASTEXITCODE -ne 0) { throw 'docker build failed' } $dest = Join-Path $PSScriptRoot '..\..\vendor\local\fmptools@2' New-Item -ItemType Directory -Force $dest | Out-Null Copy-Item (Join-Path $dist 'fmptools.mjs') $dest -Force Copy-Item (Join-Path $dist 'fmptools.wasm') $dest -Force $src = Join-Path $PSScriptRoot 'source' New-Item -ItemType Directory -Force $src | Out-Null Copy-Item (Join-Path $dist 'source\*') $src -Force Copy-Item (Join-Path $dist 'source\LICENSE') (Join-Path $PSScriptRoot 'LICENSE-fmptools.txt') -Force Get-ChildItem $dest | Select-Object Name, Length | Out-String | Write-Host