<# .SYNOPSIS Builds 7-Zip's command-line program (without the RAR code) to WebAssembly in Docker and copies it, with the worker that runs it, to frontend/vendor/local/7zip@3/, where the site serves it from /vendor/. The exact 7-Zip source tarball built is copied into source/ beside these files, so it is published at /source/7zip/ 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\7zip@3' New-Item -ItemType Directory -Force $dest | Out-Null Copy-Item (Join-Path $dist '7zz.mjs') $dest -Force Copy-Item (Join-Path $dist '7zz.wasm') $dest -Force Copy-Item (Join-Path $dist 'License.txt') $dest -Force foreach ($f in 'worker.mjs', 'run.mjs') { Copy-Item (Join-Path $PSScriptRoot "src\$f") $dest -Force } $src = Join-Path $PSScriptRoot 'source' New-Item -ItemType Directory -Force $src | Out-Null Copy-Item (Join-Path $dist '7z*-src.tar.xz') $src -Force Get-ChildItem $dest | Format-Table Name, Length