2025-12-18 01:18:59 +00:00

141 lines
4.4 KiB
Plaintext

# ╔══════════════════════════════════════════════════════════════════════╗
# ║ DEVELOPMENT UTILITIES ║
# ║ Watch, format, lint, docs ║
# ╚══════════════════════════════════════════════════════════════════════╝
# === WORKSPACE ===
WORKSPACE_ROOT := justfile_directory()
# Help for dev module
help:
@echo "DEVELOPMENT MODULE"
@echo ""
@echo "Code quality:"
@echo " just dev::fmt Format code"
@echo " just dev::fmt-check Check format (no changes)"
@echo " just dev::lint Run clippy linter"
@echo " just dev::audit Audit dependencies"
@echo ""
@echo "Documentation:"
@echo " just dev::docs Generate and open docs"
@echo " just dev::docs-gen Generate docs only"
@echo ""
@echo "Common tasks:"
@echo " just dev::build Build default features"
@echo " just dev::watch Watch and rebuild on changes"
@echo " just dev::check Check + fmt + lint"
@echo ""
@echo "Inspect:"
@echo " just dev::info Show workspace info"
@echo " just dev::tree Show dependency tree"
# === CODE FORMATTING ===
# Format all code
[doc("Format code with cargo fmt")]
fmt:
@echo "=== Formatting code ==="
cargo fmt --all
@echo "✓ Formatting complete"
# Check format without modifying
[doc("Check format without changes")]
fmt-check:
@echo "=== Checking format ==="
cargo fmt --all -- --check
@echo "✓ Format check passed"
# === LINTING ===
# Run clippy on all targets
[doc("Lint code with clippy")]
lint:
@echo "=== Linting code ==="
cargo clippy --all-targets --all-features -- -D warnings
@echo "✓ Linting complete"
# Auto-fix clippy warnings
[doc("Auto-fix clippy warnings")]
lint-fix:
@echo "=== Auto-fixing clippy warnings ==="
cargo clippy --all-targets --all-features --fix --allow-dirty
@echo "✓ Auto-fix complete"
# === DEPENDENCY AUDITING ===
# Audit dependencies for security
[doc("Audit dependencies")]
audit:
@echo "=== Auditing dependencies ==="
@command -v cargo-audit >/dev/null || (echo "cargo-audit not installed"; exit 1)
cargo audit
@echo "✓ Audit complete"
# === DOCUMENTATION ===
# Generate documentation
[doc("Generate rustdoc")]
docs-gen:
@echo "=== Generating documentation ==="
cargo doc --no-deps --all-features
@echo "✓ Documentation generated"
# Generate and open documentation
[doc("Generate docs and open browser")]
docs:
@echo "=== Opening documentation ==="
cargo doc --no-deps --all-features --open
@echo "✓ Documentation open"
# === BUILD & WATCH ===
# Quick build with default features
[doc("Build default features")]
build:
@echo "=== Quick build ==="
cargo build
@echo "✓ Build complete"
# Watch for changes and rebuild
[doc("Watch and rebuild on changes")]
watch:
@echo "=== Watching for changes... ==="
@command -v cargo-watch >/dev/null || (echo "cargo-watch not installed"; exit 1)
cargo watch -x build -x test --clear
# === COMPREHENSIVE CHECKS ===
# Run check + format + lint
[doc("Check: format + lint + compile")]
check:
@echo "=== Running comprehensive check ==="
cargo fmt --all -- --check || (echo "⚠ Format check failed"; true)
cargo clippy --all-targets --all-features -- -D warnings || (echo "⚠ Lint check failed"; true)
cargo check --all-features
@echo "✓ Check complete"
# === WORKSPACE INFO ===
# Show workspace information
[doc("Display workspace info")]
info:
@echo "WORKSPACE INFORMATION"
@echo ""
@echo "Root: {{ WORKSPACE_ROOT }}"
@echo ""
@echo "Crates:"
@cargo tree --depth 0 | grep -v "^typedialog" || cargo build --message-format=short 2>&1 | grep "Compiling" || true
@echo ""
@echo "Features:"
@echo " Default: CLI + i18n + templates"
@echo " Available: cli, tui, web, i18n, templates"
@echo ""
@echo "Binaries:"
@ls -1 target/*/typedialog* 2>/dev/null | head -6 || echo " (run 'just build' first)"
# Show dependency tree
[doc("Display dependency tree")]
tree:
@echo "=== Dependency tree ==="
cargo tree --workspace