Files
OneCAD-Draft/scripts/build-web-worker.sh
T
Afonsop c8386c6d3a build: make the Trunk web-worker hook work on Windows
Trunk passes TRUNK_STAGING_DIR as an extended-length path (\?\C:\...)
on Windows, which MSYS sh tools cannot stat, so post_build failed and
the whole web build aborted. Strip the prefix with sed before use;
Linux CI paths are unaffected.

(cherry picked from commit e3c86eca29)
2026-10-12 12:02:04 +03:00

16 lines
611 B
Bash

#!/bin/sh
set -eu
cargo build --locked --release --target wasm32-unknown-unknown --package ocs_web_worker
# On Windows, Trunk passes an extended-length path (\\?\C:\...) that MSYS sh
# tools cannot handle; strip the prefix so local web builds work there too.
# CI (Linux) paths never carry the prefix and pass through unchanged.
staging=$(printf '%s\n' "${TRUNK_STAGING_DIR:?}" | sed 's|^\\\\?\\||')
worker_out="${staging:?}/worker_pkg"
mkdir -p "$worker_out"
wasm-bindgen \
--target web \
--out-dir "$worker_out" \
--out-name ocs_web_worker \
target/wasm32-unknown-unknown/release/ocs_web_worker.wasm