2025-03-17 12:24:40 -04:00
|
|
|
# Stop the script when a cmdlet or a native command fails
|
|
|
|
# from https://www.meziantou.net/stop-the-script-when-an-error-occurs-in-powershell.htm
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$PSNativeCommandUseErrorActionPreference = $true
|
|
|
|
|
2025-04-02 15:07:18 -04:00
|
|
|
if (Test-Path rust/kcl-wasm-lib/pkg) {
|
|
|
|
rm -Recurse -Force rust/kcl-wasm-lib/pkg
|
|
|
|
}
|
2025-03-17 12:24:40 -04:00
|
|
|
mkdir -p rust/kcl-wasm-lib/pkg
|
2025-04-02 15:07:18 -04:00
|
|
|
if (Test-Path rust/kcl-lib/bindings) {
|
|
|
|
rm -Recurse -Force rust/kcl-lib/bindings
|
|
|
|
}
|
2025-03-17 12:24:40 -04:00
|
|
|
|
|
|
|
cd rust
|
|
|
|
$env:RUSTFLAGS='--cfg getrandom_backend="wasm_js"'
|
|
|
|
wasm-pack build kcl-wasm-lib --release --target web --out-dir pkg
|
|
|
|
$env:RUSTFLAGS=''
|
2025-04-26 21:21:26 -07:00
|
|
|
cargo test -p kcl-lib --features artifact-graph export_bindings
|
2025-03-17 12:24:40 -04:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
copy rust\kcl-wasm-lib\pkg\kcl_wasm_lib_bg.wasm public
|
2025-04-16 00:11:25 +10:00
|
|
|
npm run fmt
|