Rustelo/justfiles/base.just
Jesús Pérez c0281e759c
chore: update
2026-07-18 20:14:32 +01:00

106 lines
3.7 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# =============================================================================
# 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