mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-09 14:48:13 -05:00
ci: script to patch imports in the tlsn-wasm build result (#727)
This commit is contained in:
@@ -11,3 +11,20 @@ rm -rf pkg
|
||||
# Build tlsn_wasm package
|
||||
wasm-pack build --target web .
|
||||
|
||||
# Patch tlsn_wasm.js import in spawn.js snippet and copy it to the main folder
|
||||
file=$(find ./pkg/snippets -name "spawn.js" -print -quit)
|
||||
if [ -z "$file" ]; then
|
||||
echo "Error: spawn.js snippet not found"
|
||||
find pkg
|
||||
exit 1
|
||||
fi
|
||||
temp=$(mktemp)
|
||||
sed 's|../../..|../../../tlsn_wasm.js|' "$file" >"$temp" && mv "$temp" "$file"
|
||||
cp ${file} ./pkg
|
||||
|
||||
# Add all files and snippets directory to package.json
|
||||
file="pkg/package.json"
|
||||
temp=$(mktemp)
|
||||
jq '.files += ["tlsn_wasm_bg.wasm.d.ts"]' "$file" >"$temp" && mv "$temp" "$file"
|
||||
jq '.files += ["spawn.js"]' "$file" >"$temp" && mv "$temp" "$file"
|
||||
jq '.files += ["snippets/"]' "$file" >"$temp" && mv "$temp" "$file"
|
||||
|
||||
Reference in New Issue
Block a user