Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ just build

### Building

> [!TIP]
> `wasm-opt` takes a long time to run! For development purposes, build with `just wasm_build=dev build` to significantly speed up build times.

First build WebZjs with

```shell
Expand Down Expand Up @@ -137,4 +140,4 @@ at your option.
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
conditions.
19 changes: 13 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
wasm_build := "release" # change to "dev" for dev builds to speed up compile times, e.g., `just wasm_build=dev build`
wasm_release_flag := if wasm_build == "dev" {
"--no-opt"
} else {
"--release --no-opt"
}

default:
just --list

build:
just build-wallet
just build-keys
just build-requests
just wasm_build={{wasm_build}} build-wallet
just wasm_build={{wasm_build}} build-keys
just wasm_build={{wasm_build}} build-requests

build-wallet *features:
cd crates/webzjs-wallet && wasm-pack build -t web --release --scope chainsafe --out-dir ../../packages/webzjs-wallet --no-default-features --features="wasm wasm-parallel {{features}}" -Z build-std="panic_abort,std"
cd crates/webzjs-wallet && wasm-pack build -t web {{wasm_release_flag}} --scope chainsafe --out-dir ../../packages/webzjs-wallet --no-default-features --features="wasm wasm-parallel {{features}}" -Z build-std="panic_abort,std"
./add-worker-module.sh

build-keys *features:
cd crates/webzjs-keys && wasm-pack build -t web --release --scope chainsafe --out-dir ../../packages/webzjs-keys --no-default-features --features="{{features}}" -Z build-std="panic_abort,std"
cd crates/webzjs-keys && wasm-pack build -t web {{wasm_release_flag}} --scope chainsafe --out-dir ../../packages/webzjs-keys --no-default-features --features="{{features}}" -Z build-std="panic_abort,std"

build-requests *features:
cd crates/webzjs-requests && wasm-pack build -t web --release --scope chainsafe --out-dir ../../packages/webzjs-requests --no-default-features --features="{{features}}" -Z build-std="panic_abort,std"
cd crates/webzjs-requests && wasm-pack build -t web {{wasm_release_flag}} --scope chainsafe --out-dir ../../packages/webzjs-requests --no-default-features --features="{{features}}" -Z build-std="panic_abort,std"

# All Wasm Tests
test-web *features:
Expand Down