template_dir := `mktemp -d`
# Lists all available commands.
list:
@just --list
# Update sponsors data
update-sponsors:
php scripts/update-sponsors-docs.php
# Regenerate the analyzer issue codes.
regen-analyzer-issue-codes:
rm -f crates/analyzer/src/code.rs
php scripts/regen-analyzer-issue-codes.php >> crates/analyzer/src/code.rs
rustfmt crates/analyzer/src/code.rs
# Builds the library in release mode.
build:
cargo build --release
# Builds the webassembly module.
build-wasm:
cd crates/wasm && wasm-pack build --release --out-dir pkg
# Detects problems using rustfmt, clippy, and cargo check, and runs the linter and analyzer.
check:
cargo run -- fmt --check
cargo run -- lint
cargo run -- analyze
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo check --workspace --locked
# Fixes linting problems automatically using clippy, cargo fix, and rustfmt.
fix:
cargo run -- lint --fix
cargo run -- analyze --fix
cargo run -- fmt
cargo clippy --workspace --all-targets --all-features --fix --allow-dirty --allow-staged
cargo fix --allow-dirty --allow-staged
cargo fmt --all
# Runs all tests in the workspace.
test:
cargo test --workspace --locked --all-targets
# Fuzz the PHP lexer. Seeds are drawn from the syntax/analyzer/formatter PHP fixtures.
fuzz-php-lexer:
cd crates/syntax/fuzz && cargo +nightly fuzz run lexer \
corpus/lexer \
../tests/fixtures \
../../analyzer/tests/cases \
../../formatter/tests/cases
# Fuzz the PHP parser. Seeds are drawn from the syntax/analyzer/formatter PHP fixtures.
fuzz-php-parser:
cd crates/syntax/fuzz && cargo +nightly fuzz run parser \
corpus/parser \
../tests/fixtures \
../../analyzer/tests/cases \
../../formatter/tests/cases
# Fuzz the Twig lexer.
fuzz-twig-lexer:
cd crates/twig-syntax/fuzz && cargo +nightly fuzz run lexer corpus/lexer seeds/lexer
# Fuzz the Twig parser.
fuzz-twig-parser:
cd crates/twig-syntax/fuzz && cargo +nightly fuzz run parser corpus/parser seeds/parser
# Publishes all crates to crates.io in the correct order.
publish:
# Note: the order of publishing is important, as some crates depend on others.
cargo publish -p mago-bytes
cargo publish -p mago-word
cargo publish -p mago-allocator
cargo publish -p mago-casing
cargo publish -p mago-php-version
cargo publish -p mago-text-edit
cargo publish -p mago-database
cargo publish -p mago-span
cargo publish -p mago-reporting
cargo publish -p mago-syntax-core
cargo publish -p mago-syntax
cargo publish -p mago-phpdoc-syntax
cargo publish -p mago-twig-syntax
cargo publish -p mago-flags
cargo publish -p mago-hir
cargo publish -p mago-collector
cargo publish -p mago-composer
cargo publish -p mago-formatter
cargo publish -p mago-names
cargo publish -p mago-semantics
cargo publish -p mago-fingerprint
cargo publish -p mago-codex
cargo publish -p mago-prelude
cargo publish -p mago-algebra
cargo publish -p mago-guard
cargo publish -p mago-analyzer
cargo publish -p mago-linter
cargo publish -p mago-orchestrator
cargo publish -p mago-wasm
cargo publish
# Cleans all build artifacts from the workspace.
clean:
cargo clean --workspace