web/satellite: add script to compile and compress wasm module

WHAT:
compile, compress and place wasm module into the correct place

WHY:
easier usage/testing

Change-Id: I06e83ef1bed9fc62366e1400ce5ed8942bd96633
This commit is contained in:
Vitalii Shpital 2021-04-29 13:56:06 +03:00
parent a8533042a3
commit 222d9b7f0d
2 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,7 @@
"lint": "vue-cli-service lint && stylelint '**/*.{vue,scss}' --fix",
"test": "vue-cli-service test:unit",
"build": "vue-cli-service build",
"wasm": "chmod +x ./scripts/build-wasm.sh && ./scripts/build-wasm.sh",
"dev": "vue-cli-service build --mode development"
},
"dependencies": {

View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Copy wasm javascript to match the go version
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./static/wasm
# Compress wasm javascript using brotli
brotli -k -f ./static/wasm/wasm_exec.js
# Build wasm code
GOOS=js GOARCH=wasm go build -o ./static/wasm/access.wasm storj.io/storj/satellite/console/wasm
# Compress wasm code using brotli
brotli -k -f ./static/wasm/access.wasm