default: check
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all -- --check
lint:
cargo clippy --workspace --all-targets --all-features -- -D warnings
test:
cargo nextest run --workspace --all-targets
cargo test --doc
test-artifacts:
cargo nextest run --test artifacts --run-ignored ignored-only
check: fmt-check lint test
ci: check test-artifacts
package:
cargo package --locked
release-check: ci
cargo build --release --locked
cargo package --locked
gen-assets:
cargo run --locked --quiet -p xtask
# Regenerate the manual's diagrams and typeset it. Typst stamps a timestamp and
# a random instance id into the PDF, so without a fixed SOURCE_DATE_EPOCH no two
# builds of unchanged sources are byte-identical and the committed file churns.
manual: gen-assets
SOURCE_DATE_EPOCH=0 typst compile --root . docs/manual.typ docs/manual.pdf
# Build the WebAssembly module the playground loads.
playground:
wasm-pack build playground --target web --out-dir www/pkg --no-typescript
# Serve the playground at http://localhost:8080 after building it.
playground-serve: playground
python3 -m http.server 8080 --directory playground/www
install-local:
cargo install --path . --locked
# Compile one example through every backend, writing to target/ so nothing
# generated lands next to the sources.
example:
mkdir -p target/example
cargo run -- compile examples/teleportation.qrab -t latex -o target/example/teleportation.tex
cargo run -- compile examples/teleportation.qrab -t typst -o target/example/teleportation.typ
cargo run -- compile examples/teleportation.qrab -t svg -o target/example/teleportation.svg
cargo run -- compile examples/teleportation.qrab -t quirk -o target/example/teleportation.url
tectonic target/example/teleportation.tex --outdir target/example
typst compile target/example/teleportation.typ target/example/teleportation-typst.pdf
install-hooks:
pre-commit install --install-hooks