supabase-lib-rs 0.1.0

A comprehensive Rust client library for Supabase
Documentation
# 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