# Justfile for Supabase Rust Client Library
# Default recipe
default: check
# Show all available commands
help:
@just --list
# Run all pre-commit checks
check: format lint test build audit
# Setup pre-commit hooks
setup-precommit:
@echo "๐ง Setting up pre-commit hooks..."
./scripts/setup-precommit.sh
# Run pre-commit hooks manually
precommit-run:
@echo "๐ง Running pre-commit hooks..."
pre-commit run --all-files
# Run specific pre-commit hook
precommit-run-hook HOOK:
@echo "๐ง Running pre-commit hook: {{HOOK}}"
pre-commit run {{HOOK}}
# Update pre-commit hooks to latest versions
precommit-update:
@echo "๐ฆ Updating pre-commit hooks..."
pre-commit autoupdate
# Install pre-commit hooks
precommit-install:
@echo "๐ฆ Installing pre-commit hooks..."
pre-commit install
pre-commit install --hook-type commit-msg
# Format code
format:
@echo "๐ง Formatting code..."
cargo fmt
# Format code and check if changes were made
format-check:
@echo "๐ง Checking code formatting..."
cargo fmt --check
# Run clippy linter
lint:
@echo "๐ Running clippy linter..."
cargo clippy --all-targets --all-features -- -D warnings
# Run tests
test:
@echo "๐งช Running tests..."
cargo test
# Run tests with output
test-verbose:
@echo "๐งช Running tests (verbose)..."
cargo test -- --nocapture
# Run integration tests only
test-integration:
@echo "๐งช Running integration tests..."
cargo test --test '*' -- --nocapture
# Run unit tests only
test-unit:
@echo "๐งช Running unit tests..."
cargo test --lib --bins
# Run tests with coverage
coverage:
@echo "๐ Running tests with coverage..."
cargo tarpaulin --out Html --output-dir coverage
# Build the project
build:
@echo "๐จ Building project..."
cargo build
# Build in release mode
build-release:
@echo "๐จ Building project (release)..."
cargo build --release
# Security audit
audit:
@echo "๐ Running security audit..."
cargo audit
# Check dependencies for issues
deny:
@echo "๐ซ Checking dependencies..."
cargo deny check
# Update dependencies
update:
@echo "โฌ๏ธ Updating dependencies..."
cargo update
# Check for outdated dependencies
outdated:
@echo "๐
Checking for outdated dependencies..."
cargo outdated
# Clean build artifacts
clean:
@echo "๐งน Cleaning build artifacts..."
cargo clean
# Watch for file changes and run tests
watch:
@echo "๐ Watching for changes..."
cargo watch -x test
# Watch for file changes and run specific command
watch-cmd cmd:
@echo "๐ Watching for changes and running: {{cmd}}"
cargo watch -x "{{cmd}}"
# Generate documentation
docs:
@echo "๐ Generating documentation..."
cargo doc --no-deps --open
# Generate documentation without opening browser
docs-build:
@echo "๐ Generating documentation..."
cargo doc --no-deps
# Run benchmarks
bench:
@echo "๐ Running benchmarks..."
cargo bench
# Analyze binary size
bloat:
@echo "๐ Analyzing binary size..."
cargo bloat --release
# Install development tools
install-tools:
@echo "๐ง Installing development tools..."
cargo install cargo-audit cargo-deny cargo-outdated cargo-edit cargo-watch cargo-tarpaulin cargo-bloat
# Run example
example name:
@echo "๐ Running example: {{name}}"
cargo run --example {{name}}
# Run all examples
examples:
@echo "๐ Running all examples..."
@for example in basic_usage auth_example database_example storage_example realtime_example; do \
echo "Running example: $example"; \
cargo run --example $example || true; \
done
# Setup development environment
setup:
@echo "๐ ๏ธ Setting up development environment..."
@if [ ! -f Cargo.lock ]; then echo "Generating Cargo.lock..."; cargo generate-lockfile; fi
@echo "โ
Development environment ready!"
# Pre-commit hook (run before committing)
pre-commit: format-check lint test build
@echo "โ
All pre-commit checks passed!"
# Release preparation
release-prep: clean format lint test build-release audit docs-build
@echo "๐ฆ Release preparation complete!"
# Start local Supabase for testing (requires Docker)
supabase-start:
@echo "๐ Starting local Supabase..."
@if command -v supabase >/dev/null 2>&1; then \
supabase start; \
else \
echo "โ Supabase CLI not found. Install from: https://supabase.com/docs/guides/cli"; \
fi
# Stop local Supabase
supabase-stop:
@echo "๐ Stopping local Supabase..."
@if command -v supabase >/dev/null 2>&1; then \
supabase stop; \
else \
echo "โ Supabase CLI not found."; \
fi
# Reset local Supabase
supabase-reset:
@echo "๐ Resetting local Supabase..."
@if command -v supabase >/dev/null 2>&1; then \
supabase db reset; \
else \
echo "โ Supabase CLI not found."; \
fi
# Nix-specific commands
# Build with Nix
nix-build:
@echo "โ๏ธ Building with Nix..."
nix build
# Run checks with Nix
nix-check:
@echo "โ๏ธ Running Nix flake checks..."
nix flake check
# Update Nix flake inputs
nix-update:
@echo "โ๏ธ Updating Nix flake inputs..."
nix flake update
# Enter development shell
nix-shell:
@echo "โ๏ธ Entering Nix development shell..."
nix develop
# Show flake info
nix-info:
@echo "โ๏ธ Showing flake information..."
nix flake show