.PHONY: help install build test bench clean docs demo e2e wasm dev check format lint audit pre-commit install-pre-commit
help:
@echo "๐ Leptos Query Development Commands"
@echo ""
@echo "๐ฆ Setup & Installation:"
@echo " install - Install dependencies (pnpm + Rust)"
@echo " nix-shell - Enter Nix development shell"
@echo ""
@echo "๐จ Build & Development:"
@echo " build - Build the library"
@echo " dev - Start development server"
@echo " demo - Build demo application"
@echo " wasm - Build WASM package"
@echo ""
@echo "๐งช Testing & Quality:"
@echo " test - Run Rust tests"
@echo " e2e - Run Playwright E2E tests"
@echo " bench - Run benchmarks"
@echo " check - Run all checks (test + bench + e2e)"
@echo " format - Format code with rustfmt"
@echo " lint - Run clippy linting"
@echo " audit - Security audit"
@echo " pre-commit - Run pre-commit hooks"
@echo " install-pre-commit - Install pre-commit hooks"
@echo ""
@echo "๐ Documentation:"
@echo " docs - Build documentation"
@echo " docs-serve - Serve documentation locally"
@echo ""
@echo "๐งน Maintenance:"
@echo " clean - Clean build artifacts"
@echo " distclean - Deep clean (including node_modules)"
NIX_ENV := $(shell if command -v nix >/dev/null 2>&1 && nix flake show >/dev/null 2>&1; then echo "yes"; else echo "no"; fi)
install:
@echo "๐ฆ Installing dependencies..."
@if [ "$(NIX_ENV)" = "yes" ]; then \
echo "๐ง Using Nix environment..."; \
nix develop --command echo "Nix environment ready"; \
else \
echo "๐ง Installing Rust toolchain..."; \
rustup default stable; \
rustup target add wasm32-unknown-unknown; \
echo "๐ง Installing Trunk..."; \
cargo install trunk; \
echo "๐ง Installing wasm-pack..."; \
cargo install wasm-pack; \
echo "๐ง Installing pnpm..."; \
if ! command -v pnpm >/dev/null 2>&1; then \
npm install -g pnpm; \
fi; \
echo "๐ง Installing Playwright..."; \
cd demo && pnpm install && pnpm exec playwright install; \
fi
nix-shell:
@if [ "$(NIX_ENV)" = "yes" ]; then \
echo "๐ง Entering Nix development shell..."; \
nix develop; \
else \
echo "โ Nix flake not available. Run 'make install' instead."; \
exit 1; \
fi
build:
@echo "๐จ Building library..."
cargo build --all-features --release
demo:
@echo "๐จ Building demo application..."
cd demo && trunk build
wasm:
@echo "๐ Building WASM package..."
wasm-pack build --target web --out-dir dist
test:
@echo "๐งช Running Rust tests..."
cargo test --all-features --release
e2e:
@echo "๐ Running Playwright E2E tests..."
@if [ -d "demo" ]; then \
cd demo && pnpm test:e2e; \
else \
echo "โ Demo directory not found. Run 'make demo' first."; \
exit 1; \
fi
bench:
@echo "๐ Running benchmarks..."
cargo bench --all-features
check: test bench e2e
@echo "โ
All checks passed!"
format:
@echo "๐จ Formatting code..."
cargo fmt --all
lint:
@echo "๐ Running clippy..."
cargo clippy --all-features -- -D warnings
audit:
@echo "๐ Security audit..."
cargo audit
install-pre-commit:
@echo "๐ง Installing pre-commit hooks..."
./scripts/install-pre-commit.sh
pre-commit:
@echo "๐ Running pre-commit hooks..."
pre-commit run --all-files
docs:
@echo "๐ Building documentation..."
cargo doc --all-features --no-deps --open
docs-serve:
@echo "๐ Serving documentation..."
cargo doc --all-features --no-deps
@echo "๐ Documentation available at: file://$(PWD)/target/doc/leptos_query_rs/index.html"
dev:
@echo "๐ Starting development server..."
cd demo && trunk serve
clean:
@echo "๐งน Cleaning build artifacts..."
cargo clean
@if [ -d "demo" ]; then \
cd demo && rm -rf dist target; \
fi
rm -rf dist target
distclean: clean
@echo "๐งน Deep cleaning..."
@if [ -d "demo" ]; then \
cd demo && rm -rf node_modules pnpm-lock.yaml; \
fi
rm -rf .cargo .rustup
ci: format lint test bench e2e audit
@echo "โ
CI pipeline completed successfully!"
release-check: format lint test bench e2e audit
@echo "โ
Release checks passed!"
@echo "๐ Ready for release!"
nix-build:
@if [ "$(NIX_ENV)" = "yes" ]; then \
echo "๐ง Building with Nix..."; \
nix build .; \
else \
echo "โ Nix flake not available."; \
exit 1; \
fi
nix-test:
@if [ "$(NIX_ENV)" = "yes" ]; then \
echo "๐ง Testing with Nix..."; \
nix run .#test; \
else \
echo "โ Nix flake not available."; \
exit 1; \
fi
dev-setup: install build demo
@echo "๐ Development environment ready!"
@echo "Run 'make dev' to start the development server"
dev-cycle: format lint test
@echo "๐ Development cycle completed!"
env-info:
@echo "๐ Environment Information:"
@echo " Rust: $(shell rustc --version 2>/dev/null || echo 'Not installed')"
@echo " Cargo: $(shell cargo --version 2>/dev/null || echo 'Not installed')"
@echo " Node: $(shell node --version 2>/dev/null || echo 'Not installed')"
@echo " pnpm: $(shell pnpm --version 2>/dev/null || echo 'Not installed')"
@echo " Trunk: $(shell trunk --version 2>/dev/null || echo 'Not installed')"
@echo " Nix: $(shell if [ "$(NIX_ENV)" = "yes" ]; then echo "Available"; else echo "Not available"; fi)"