.PHONY: help dev build test test-rust test-e2e clean install-deps setup-playwright lint fmt check docs # Default target help: ## Show this help message @echo "shadcn/ui Rust Development Commands" @echo "==================================" @echo "" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' # Development dev: ## Start development environment with file watching @echo "๐Ÿš€ Starting development environment..." cargo watch -x "check --workspace" -x "test --workspace --lib" dev-examples: ## Run example applications @echo "๐ŸŒŸ Starting Leptos examples..." cd book-examples/leptos && trunk serve --open # Building build: ## Build all packages and examples @echo "๐Ÿ”จ Building all packages..." cargo build --workspace cargo build --workspace --target wasm32-unknown-unknown build-release: ## Build optimized release versions @echo "๐Ÿ—๏ธ Building release versions..." cargo build --workspace --release cargo build --workspace --release --target wasm32-unknown-unknown build-examples: ## Build example applications @echo "๐Ÿ“ฆ Building examples..." cd book-examples/leptos && trunk build --release cd book-examples/yew && trunk build --release # Testing test: test-rust test-e2e ## Run all tests (Rust + E2E) test-rust: ## Run Rust unit and integration tests @echo "๐Ÿงช Running Rust tests..." cargo test --workspace --lib cargo test --workspace --target wasm32-unknown-unknown test-rust-verbose: ## Run Rust tests with verbose output @echo "๐Ÿ” Running Rust tests (verbose)..." RUST_LOG=debug cargo test --workspace --lib -- --nocapture test-single: ## Run tests for a specific component (usage: make test-single COMPONENT=button) @if [ -z "$(COMPONENT)" ]; then \ echo "โŒ Please specify COMPONENT. Usage: make test-single COMPONENT=button"; \ exit 1; \ fi @echo "๐ŸŽฏ Testing $(COMPONENT) component..." cargo test -p shadcn-ui-leptos-$(COMPONENT) cargo test -p shadcn-ui-yew-$(COMPONENT) test-e2e: install-playwright ## Run Playwright E2E tests @echo "๐ŸŽญ Running Playwright E2E tests..." pnpm playwright test test-e2e-headed: ## Run Playwright tests in headed mode @echo "๐ŸŽญ Running Playwright E2E tests (headed)..." pnpm playwright test --headed test-e2e-ui: ## Run Playwright E2E tests with UI @echo "๐ŸŽญ Running Playwright E2E tests with UI..." pnpm playwright test --ui test-e2e-debug: ## Run Playwright E2E tests in debug mode @echo "๐Ÿ› Running Playwright E2E tests in debug mode..." pnpm playwright test --debug test-e2e-specific: ## Run specific E2E test file (usage: make test-e2e-specific FILE=filename) @echo "๐ŸŽฏ Running specific E2E test: $(FILE)..." pnpm playwright test $(FILE) test-e2e-browser: ## Run E2E tests in specific browser (usage: make test-e2e-browser BROWSER=chromium) @echo "๐ŸŒ Running E2E tests in $(BROWSER)..." pnpm playwright test --project=$(BROWSER) test-e2e-parallel: ## Run E2E tests in parallel @echo "โšก Running E2E tests in parallel..." pnpm playwright test --workers=4 test-e2e-report: ## Generate E2E test report @echo "๐Ÿ“Š Generating E2E test report..." pnpm playwright show-report test-e2e-install: ## Install Playwright browsers @echo "๐Ÿ“ฆ Installing Playwright browsers..." pnpm playwright install test-e2e-codegen: ## Generate E2E test code @echo "๐Ÿ”„ Generating E2E test code..." pnpm playwright codegen http://127.0.0.1:8080 # WASM Testing test-wasm: ## Run comprehensive WASM browser tests @echo "๐Ÿงช Running WASM browser tests..." ./scripts/run-wasm-tests.sh test-wasm-browsers: ## Run WASM tests on specific browsers (usage: make test-wasm-browsers BROWSERS=chromium,firefox) @if [ -z "$(BROWSERS)" ]; then \ echo "โŒ Please specify BROWSERS. Usage: make test-wasm-browsers BROWSERS=chromium,firefox"; \ exit 1; \ fi @echo "๐Ÿงช Running WASM tests on $(BROWSERS)..." ./scripts/run-wasm-tests.sh -b "$(BROWSERS)" test-wasm-headed: ## Run WASM tests in headed mode @echo "๐Ÿงช Running WASM tests in headed mode..." ./scripts/run-wasm-tests.sh -H test-wasm-parallel: ## Run WASM tests in parallel @echo "๐Ÿงช Running WASM tests in parallel..." ./scripts/run-wasm-tests.sh -p test-wasm-verbose: ## Run WASM tests with verbose output @echo "๐Ÿงช Running WASM tests with verbose output..." ./scripts/run-wasm-tests.sh -v # Enhanced E2E Testing test-e2e-enhanced: ## Run enhanced E2E tests with comprehensive reporting @echo "๐ŸŽญ Running enhanced E2E tests..." pnpm playwright test --config=playwright.config.ts test-e2e-ci: ## Run E2E tests in CI mode @echo "๐Ÿš€ Running E2E tests in CI mode..." CI=true pnpm playwright test --config=playwright.config.ts test-e2e-debug: ## Run E2E tests in debug mode @echo "๐Ÿ› Running E2E tests in debug mode..." DEBUG=true HEADLESS=false pnpm playwright test --config=playwright.config.ts test-e2e-performance: ## Run E2E performance tests only @echo "๐Ÿ“ˆ Running E2E performance tests..." pnpm playwright test --project=performance-tests test-e2e-accessibility: ## Run E2E accessibility tests only @echo "โ™ฟ Running E2E accessibility tests..." pnpm playwright test --project=accessibility-tests test-e2e-wasm: ## Run E2E WASM tests only @echo "๐Ÿงช Running E2E WASM tests..." pnpm playwright test --project=wasm-tests test-e2e-report: ## Generate comprehensive E2E test report @echo "๐Ÿ“Š Generating E2E test report..." pnpm playwright show-report # Performance Benchmarking benchmark: ## Run performance benchmarks @echo "๐Ÿƒ Running performance benchmarks..." ./scripts/run-performance-benchmarks.sh benchmark benchmark-components: ## Run benchmarks for specific components (usage: make benchmark-components COMPONENTS=button,input) @if [ -z "$(COMPONENTS)" ]; then \ echo "โŒ Please specify COMPONENTS. Usage: make benchmark-components COMPONENTS=button,input"; \ exit 1; \ fi @echo "๐Ÿƒ Running benchmarks for $(COMPONENTS)..." ./scripts/run-performance-benchmarks.sh benchmark -c "$(COMPONENTS)" benchmark-html: ## Run benchmarks and generate HTML report @echo "๐Ÿƒ Running benchmarks with HTML report..." ./scripts/run-performance-benchmarks.sh benchmark -f html -o test-results/performance/benchmark-report.html regression-test: ## Run performance regression tests @echo "๐Ÿ“Š Running performance regression tests..." ./scripts/run-performance-benchmarks.sh regression regression-update: ## Run regression tests and update baseline @echo "๐Ÿ“Š Running regression tests with baseline update..." ./scripts/run-performance-benchmarks.sh regression -u performance-monitor: ## Start automated performance monitoring @echo "๐Ÿ“ˆ Starting automated performance monitoring..." ./scripts/run-performance-benchmarks.sh monitor performance-monitor-alerts: ## Start monitoring with alerts enabled @echo "๐Ÿ“ˆ Starting performance monitoring with alerts..." ./scripts/run-performance-benchmarks.sh monitor -a setup-baseline: ## Setup performance baseline @echo "๐Ÿ”ง Setting up performance baseline..." ./scripts/run-performance-benchmarks.sh setup performance-report: ## Generate performance report @echo "๐Ÿ“„ Generating performance report..." ./scripts/run-performance-benchmarks.sh report # Accessibility Automation accessibility-audit: ## Run comprehensive accessibility audit @echo "โ™ฟ Running accessibility audit..." ./scripts/run-accessibility-audit.sh accessibility-audit-wcag: ## Run accessibility audit with specific WCAG level (usage: make accessibility-audit-wcag LEVEL=AAA) @if [ -z "$(LEVEL)" ]; then \ echo "โŒ Please specify LEVEL. Usage: make accessibility-audit-wcag LEVEL=AAA"; \ exit 1; \ fi @echo "โ™ฟ Running accessibility audit with WCAG $(LEVEL)..." ./scripts/run-accessibility-audit.sh -l "$(LEVEL)" accessibility-audit-components: ## Run accessibility audit for specific components (usage: make accessibility-audit-components COMPONENTS=button,input) @if [ -z "$(COMPONENTS)" ]; then \ echo "โŒ Please specify COMPONENTS. Usage: make accessibility-audit-components COMPONENTS=button,input"; \ exit 1; \ fi @echo "โ™ฟ Running accessibility audit for $(COMPONENTS)..." ./scripts/run-accessibility-audit.sh -c "$(COMPONENTS)" accessibility-audit-html: ## Run accessibility audit and generate HTML report @echo "โ™ฟ Running accessibility audit with HTML report..." ./scripts/run-accessibility-audit.sh -f html -o test-results/accessibility/accessibility-report.html accessibility-audit-verbose: ## Run accessibility audit with verbose output @echo "โ™ฟ Running accessibility audit with verbose output..." ./scripts/run-accessibility-audit.sh -v accessibility-audit-focus: ## Run accessibility audit focusing on focus management @echo "โ™ฟ Running accessibility audit focusing on focus management..." ./scripts/run-accessibility-audit.sh --no-color-contrast --no-screen-reader # Production Readiness analyze-bundle: ## Analyze bundle sizes and optimization opportunities @echo "๐Ÿ“ฆ Analyzing bundle sizes for production readiness..." ./scripts/analyze_bundle.sh build-production: ## Build production-optimized version @echo "๐Ÿ—๏ธ Building production-optimized version..." ./scripts/build_production.sh production-check: analyze-bundle build-production ## Complete production readiness check @echo "โœ… Production readiness check complete!" # Quality & Linting check: ## Run cargo check on all packages @echo "โœ… Checking all packages..." cargo check --workspace cargo check --workspace --target wasm32-unknown-unknown lint: ## Run clippy linting @echo "๐Ÿ“Ž Running clippy..." cargo clippy --workspace -- -D warnings cargo clippy --workspace --target wasm32-unknown-unknown -- -D warnings fmt: ## Format code with rustfmt @echo "๐ŸŽจ Formatting code..." cargo fmt --all fmt-check: ## Check if code is formatted @echo "๐Ÿ” Checking code formatting..." cargo fmt --all -- --check audit: ## Run security audit @echo "๐Ÿ”’ Running security audit..." cargo audit # Dependencies install-deps: ## Install all dependencies @echo "๐Ÿ“ฆ Installing dependencies..." pnpm install install-playwright: ## Install Playwright and browsers @echo "๐ŸŽญ Installing Playwright..." pnpm create playwright@latest --yes pnpm playwright install setup-playwright: install-deps install-playwright ## Complete Playwright setup @echo "โœ… Playwright setup complete!" # Documentation docs: ## Generate and open documentation @echo "๐Ÿ“š Generating documentation..." cargo doc --workspace --open docs-book: ## Build and serve the documentation book @echo "๐Ÿ“– Building documentation book..." cd book && mdbook serve --open # Maintenance clean: ## Clean build artifacts @echo "๐Ÿงน Cleaning build artifacts..." cargo clean rm -rf book-examples/*/dist rm -rf node_modules rm -rf .playwright-browsers clean-cache: ## Clean cargo cache and lock files @echo "๐Ÿ—‘๏ธ Cleaning caches..." cargo clean rm -f Cargo.lock rm -f package-lock.json update-deps: ## Update all dependencies @echo "โฌ†๏ธ Updating dependencies..." cargo update pnpm update # Component Generation generate-component: ## Generate a new component (usage: make generate-component NAME=my-component FRAMEWORK=leptos) @if [ -z "$(NAME)" ] || [ -z "$(FRAMEWORK)" ]; then \ echo "โŒ Please specify NAME and FRAMEWORK. Usage: make generate-component NAME=my-component FRAMEWORK=leptos"; \ exit 1; \ fi @echo "๐Ÿ—๏ธ Generating $(NAME) component for $(FRAMEWORK)..." cargo run --bin component-generator -- --name $(NAME) --framework $(FRAMEWORK) # Nix integration nix-develop: ## Enter Nix development shell @echo "โ„๏ธ Entering Nix development shell..." nix develop nix-build: ## Build using Nix @echo "โ„๏ธ Building with Nix..." nix build # Quick fixes fix-permissions: ## Fix file permissions @echo "๐Ÿ”ง Fixing file permissions..." find . -name "*.rs" -type f -exec chmod 644 {} \; find . -name "*.toml" -type f -exec chmod 644 {} \; find scripts -name "*.sh" -type f -exec chmod +x {} \; # Git hooks install-git-hooks: ## Install git pre-commit hooks @echo "๐Ÿช Installing git hooks..." echo '#!/bin/sh\nmake fmt-check && make check && make test-rust' > .git/hooks/pre-commit chmod +x .git/hooks/pre-commit echo "โœ… Git hooks installed!" # Environment info env-info: ## Show environment information @echo "Environment Information:" @echo "=======================" @echo "Rust version: $$(rustc --version 2>/dev/null || echo 'Not installed')" @echo "Cargo version: $$(cargo --version 2>/dev/null || echo 'Not installed')" @echo "Node.js version: $$(node --version 2>/dev/null || echo 'Not installed')" @echo "pnpm version: $$(pnpm --version 2>/dev/null || echo 'Not installed')" @echo "Make version: $$(make --version 2>/dev/null | head -n1 || echo 'Not installed')" @echo "Git version: $$(git --version 2>/dev/null || echo 'Not installed')" @if command -v nix >/dev/null 2>&1; then \ echo "Nix version: $$(nix --version 2>/dev/null)"; \ else \ echo "Nix version: Not installed"; \ fi