<# .SYNOPSIS Builds SQLite with its recovery extension to WebAssembly in Docker and copies it, with its worker, engine and the licence, to frontend/vendor/local/sqlite-recover@1/, where the site serves it from /vendor/. SQLite is pinned by version and SHA-256 in the Dockerfile; these build files are published at /source/sqlite-recover/. 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\sqlite-recover@1' New-Item -ItemType Directory -Force $dest | Out-Null Copy-Item (Join-Path $dist 'sqlite-recover.mjs') $dest -Force Copy-Item (Join-Path $dist 'sqlite-recover.wasm') $dest -Force Copy-Item (Join-Path $dist 'LICENSE-sqlite.md') $dest -Force Copy-Item (Join-Path $PSScriptRoot 'src\engine.mjs') $dest -Force Copy-Item (Join-Path $PSScriptRoot 'src\worker.mjs') $dest -Force Get-ChildItem $dest | Select-Object Name, Length | Out-String | Write-Host