106 lines
3.7 KiB
Text
106 lines
3.7 KiB
Text
# =============================================================================
|
||
# 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
|