# ============================================================================= # BASE DEVELOPMENT COMMANDS - Rustelo Framework # ============================================================================= # Core development commands for any Rustelo-based project # Start development server with hot reload dev: @echo "๐Ÿš€ Starting development server..." cargo leptos watch # Start development server with custom port dev-port port="3030": @echo "๐Ÿš€ Starting development server on port {{port}}..." LEPTOS_SITE_ADDR="127.0.0.1:{{port}}" cargo leptos watch # Start development server with CSS watching dev-full: @echo "๐Ÿš€ Starting full development environment..." @just css-watch & cargo leptos watch # Watch CSS files for changes css-watch: @echo "๐Ÿ‘๏ธ Watching CSS files..." @if [ -f "package.json" ]; then npm run watch:css; else echo "โš ๏ธ No package.json found, skipping CSS watch"; fi # Build CSS files css-build: @echo "๐ŸŽจ Building CSS files..." @if [ -f "package.json" ]; then npm run build:css; else echo "โš ๏ธ No package.json found, skipping CSS build"; fi # Setup project dependencies and tools setup: @echo "๐Ÿ“ฆ Setting up project dependencies and tools..." @if [ -f "package.json" ]; then echo "๐Ÿ“ฆ Installing npm dependencies..." && npm install; else echo "โ„น๏ธ No package.json found, skipping npm install"; fi @echo "๐Ÿฆ€ Installing cargo-leptos..." cargo install cargo-leptos # Install development dependencies dev-deps: @echo "๐Ÿ“ฆ Installing development dependencies..." @if [ -f "package.json" ]; then echo "๐Ÿ“ฆ Installing npm dependencies..." && npm install; else echo "โ„น๏ธ No package.json found, skipping npm install"; fi @echo "๐Ÿฆ€ Installing cargo-leptos..." cargo install cargo-leptos # ============================================================================= # BUILD COMMANDS # ============================================================================= # Build project for development build: @echo "๐Ÿ”จ Building project..." cargo leptos build # Build project for production build-prod: @echo "๐Ÿ”จ Building for production..." cargo leptos build --release # Build for production with automatic WASM dispatch driven by the rendering profile build-auto routes_dir="site/config/routes" workspace_config="site/config/rendering.toml" bin="": @echo "๐Ÿ” Inspecting rendering profile for {{routes_dir}} + {{workspace_config}}..." @if nu {{project_root}}/scripts/check-wasm-needed.nu --verbose \ --routes-dir {{routes_dir}} \ --workspace-config {{workspace_config}}; then \ echo "๐Ÿ”จ WASM required โ€” running cargo leptos build --release"; \ cargo leptos build --release; \ else \ echo "๐Ÿชถ Pure htmx-ssr โ€” skipping wasm32 target"; \ if [ -n "{{bin}}" ]; then \ cargo build --release -p {{bin}} --no-default-features --features ssr,htmx-ssr; \ else \ cargo build --release --no-default-features --features ssr,htmx-ssr; \ fi \ fi # Clean build artifacts clean: @echo "๐Ÿงน Cleaning build artifacts..." cargo clean rm -rf pkg/ rm -rf dist/ # ============================================================================= # TEST COMMANDS # ============================================================================= # Run all tests test: @echo "๐Ÿงช Running tests..." cargo test # Run tests with coverage test-coverage: @echo "๐Ÿงช Running tests with coverage..." cargo tarpaulin --out Html # Run end-to-end tests test-e2e: @echo "๐Ÿงช Running e2e tests..." cd end2end && npm test # Run tests in watch mode test-watch: @echo "๐Ÿงช Running tests in watch mode..." cargo watch -x test