build-wasm.sh raw

   1  #!/bin/sh
   2  # Build the deployed client with TinyGo, and run the packages it ships under TinyGo too.
   3  #
   4  # The client runs in a browser, so the compiler that produces the real artifact is TinyGo, not
   5  # Go. A test that only ever runs under Go can pass while the deployment build breaks, so the
   6  # packages the wasm binary ships are checked with the same compiler here.
   7  #
   8  #   GO=/path/to/go1.24.6 ./scripts/build-wasm.sh [output.wasm]
   9  #
  10  set -eu
  11  
  12  export GOROOT=${GOROOT:-/home/mleku/sdk/go1.24.6}
  13  export PATH=$GOROOT/bin:$PATH
  14  OUT=${1:-bin/nostrino-channel.wasm}
  15  
  16  mkdir -p "$(dirname "$OUT")"
  17  
  18  echo "tinygo build -> $OUT"
  19  tinygo build -target wasm -o "$OUT" ./cmd/nostrino-channel
  20  
  21  echo "tinygo test: packages the wasm build ships"
  22  tinygo test -target wasm ./pkg/btcwire ./pkg/chain
  23