<# .SYNOPSIS Builds DeepFilterNet 3's runtime (libDF) to WebAssembly in Docker and copies it, with the model and the worker that runs it, to frontend/vendor/local/deepfilter@1/, where the site serves it from /vendor/. Bump the @N (and the path in the page) before rebuilding once a version has shipped. 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\deepfilter@1' New-Item -ItemType Directory -Force $dest | Out-Null foreach ($f in 'deepfilter.js', 'deepfilter_bg.wasm', 'LICENSE-MIT', 'LICENSE-APACHE') { Copy-Item (Join-Path $dist $f) $dest -Force } # Served as .bin: nginx's /vendor/ types have no .gz, and the worker reads it as bytes. Copy-Item (Join-Path $dist 'DeepFilterNet3_onnx.tar.gz') (Join-Path $dest 'deepfilternet3.bin') -Force Copy-Item (Join-Path $PSScriptRoot 'src\worker.mjs') $dest -Force Get-ChildItem $dest | Format-Table Name, Length