Current section
Files
Jump to
Current section
Files
build.sh
#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
OUTPUT="${1:-jsonnex.wasm}"
echo "==> Downloading dependencies..."
cd "$SCRIPT_DIR/native"
go mod tidy
echo "==> Building jsonnet.wasm..."
GOOS=wasip1 GOARCH=wasm go build -ldflags="-s -w" -o "$OUTPUT" .
SIZE=$(du -h "$OUTPUT" | cut -f1)
echo "==> Built $OUTPUT ($SIZE)"
echo "==> Copy WASM artifact to priv..."
mv ./$OUTPUT $SCRIPT_DIR/priv/jsonnex.wasm