# Task runner [just](https://just.systems/)
# Install with `cargo install just`.
# List all available recipes
[default]
_recipes:
just --list
# Check if a required tool is installed
_ensure-tool tool:
@command -v {{ tool }} >/dev/null 2>&1 || ( echo "'{{ tool }}' is not installed" && exit 1 )
# Check code quality
check:
cargo clippy --target wasm32-unknown-unknown -- -D warnings
cargo +nightly fmt --all -- --check
cargo publish --dry-run --allow-dirty --target wasm32-unknown-unknown
@just _ensure-tool npm
npm --prefix bevy-remote-wasm-types install && npm --prefix bevy-remote-wasm-types run check
# Format
format:
cargo +nightly fmt --all
# Run tests
test:
@just _ensure-tool wasm-bindgen-test-runner
cargo test --lib --target wasm32-unknown-unknown \
--config "target.wasm32-unknown-unknown.runner = 'wasm-bindgen-test-runner'"
# List all available apps
list-apps:
@echo "Available apps:"
@ls -1 apps/*/index.html | sed -E 's|apps/([^/]+)/index\.html|\1|'
# List all available examples
list-examples:
@echo "Available examples:"
@ls -1 examples/*.rs | sed -E 's|examples/([^/]+)\.rs|\1|'
# Build a specific example
build-example example="minimal" app="get-version":
@just _ensure-tool wasm-bindgen
@echo "Building '{{ example }}' example with '{{ app }}' app ..."
@rm -rf target/dist/{{ app }}
@mkdir -p target/dist/{{ app }}
@cp apps/{{ app }}/* target/dist/{{ app }}/
cargo build --quiet --example {{ example }} --target wasm32-unknown-unknown
wasm-bindgen --target web --out-dir target/dist/{{ app }} --out-name example target/wasm32-unknown-unknown/debug/examples/{{ example }}.wasm
# Serve a specific example on localhost
run-example example="minimal" app="get-version" port="8080":
@just _ensure-tool miniserve
just build-example {{ example }} {{ app }}
@echo "Serving '{{ example }}' example with '{{ app }}' app on <http://localhost:{{ port }}> ..."
miniserve --quiet --index index.html --port {{ port }} target/dist/{{ app }}