storj/scripts/build-wasm.sh
VitaliiShpital 79a3a47805 build: added brotli compression for wasm bits
WHAT:
added brotli compression for wasm files and added copying of those files to static/wasm folder in Dockerfile

WHY:
those files are a part of web worker webpack bundle and I didn't find a way to compress them separately using webpack.
I'm open to any other ideas if they come up

Change-Id: I105cc1582e9816fd9b63052ba48358525c85a164
2020-12-17 19:23:53 +00:00

20 lines
472 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
set -o pipefail
# Ensure the directory exists
mkdir -p release/$TAG/wasm/
# Copy wasm javascript to match the go version
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" release/$TAG/wasm/
# Compress wasm javascript using brotli
brotli -k release/$TAG/wasm/wasm_exec.js
# Build wasm code
go build -o release/$TAG/wasm/access.wasm storj.io/storj/satellite/console/wasm
# Compress wasm code using brotli
brotli -k release/$TAG/wasm/access.wasm