format *extras:
cargo +nightly fmt {{ extras }}
doc *extras:
cargo +nightly doc --all-features -Zunstable-options -Zrustdoc-scrape-examples --locked {{ extras }}
doctest:
cargo test --doc --all-features --locked
# TODO: unit tests
test: doctest
clippy *extras:
cargo +nightly clippy --all-features --all-targets --locked --no-deps {{ extras }} -- --deny warnings
# TODO: --all-features flag doesn't work because examples shenanigans
check_all_features:
cargo all-features check --locked
example name *extras:
cargo run --example {{ name }} {{ extras }}
# TODO: use inline module to make this cleaner https://github.com/casey/just/issues/2442
example_wasm name *extras:
RUSTFLAGS='--cfg=web_sys_unstable_apis --cfg=getrandom_backend="wasm_js"' CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-server-runner cargo run --target wasm32-unknown-unknown --example {{ name }} {{ extras }}
release *extras:
cargo release --unpublished --sign-tag {{ extras }}
# TODO: https://github.com/release-plz/release-plz/issues/1773
sign_tag tag:
GIT_COMMITTER_DATE="$(git log -1 --format=%aD {{ tag }})" git tag {{ tag }} {{ tag }}^{} -f -s && git push --tags --force
list_examples:
@cargo metadata --no-deps --format-version 1 | jq -c --argjson exclude '[{{ exclude_examples }}]' '[.packages[].targets[] | select(.kind[] == "example" and (.name as $name | $exclude | index($name) | not)) | .name]'
generate_wasm_example_index library example has_assets *features:
echo '(import kaaj).wasm_example_index_template' | nickel eval --field index_html --manifest-path nickel/Nickel-pkg.ncl -- 'library="{{ library }}"' 'example="{{ example }}"' --override 'features=["{{ features }}"]' --override 'has_assets="{{ has_assets }}"' | sed 's/^"//; s/"$//; s/\\"/"/g; s/\\n/\n/g'
build_wasm_example library example has_assets *features:
just generate_wasm_example_index {{ library }} {{ example }} {{ has_assets }} {{ features }} > index.html
RUSTFLAGS='--cfg getrandom_backend="wasm_js"' trunk build --locked --release --public-url . --example {{ example }}
format_nickels:
nickel format --manifest-path nickel/Nickel-pkg.ncl nickel/*.ncl
export_nickel nickel:
nickel export --format yaml --field {{ nickel }}_ nickel/main.ncl
# TODO: use https://github.com/rhysd/actionlint after
sync_nickels:
@for nickel in {{ export_nickels }}; do \
echo "# generated by nickel/$nickel.ncl; do not manually edit" > ./.github/workflows/$nickel.yaml; \
just export_nickel $nickel >> ./.github/workflows/$nickel.yaml; \
done