2021-05-10 11:25:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
## requires wasm-pack
|
|
|
|
## > curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
|
|
|
|
|
|
(
|
|
|
|
cd ../..;
|
|
|
|
mkdir -p ./avm/client/wasm || exit;
|
|
|
|
wasm-pack build ./air-interpreter --no-typescript --release -d ../avm/client/wasm
|
|
|
|
)
|
|
|
|
|
2021-08-04 13:41:37 +00:00
|
|
|
## base64 on MacOS doesn't have -w option
|
|
|
|
if echo | base64 -w0 > /dev/null 2>&1;
|
|
|
|
then
|
|
|
|
BASE64=$(base64 -w0 wasm/air_interpreter_client_bg.wasm)
|
|
|
|
else
|
|
|
|
BASE64=$(base64 wasm/air_interpreter_client_bg.wasm)
|
|
|
|
fi
|
|
|
|
|
2021-05-10 11:25:34 +00:00
|
|
|
cat << EOF > ./src/wasm.js
|
|
|
|
// auto-generated
|
|
|
|
|
2021-08-04 13:41:37 +00:00
|
|
|
module.exports = "$BASE64";
|
2021-05-10 11:25:34 +00:00
|
|
|
EOF
|