对 47 个前端文件统一执行 npm run format,消除存量格式差异。 随后在 CI 与 Makefile check 中启用 format:check,确保后续提交强制遵守 prettier 风格。
84 lines
2.1 KiB
Makefile
84 lines
2.1 KiB
Makefile
# PicoBot Web UI Makefile
|
|
|
|
.PHONY: dev dev-backend dev-frontend build clean install check fmt fix help
|
|
|
|
# Default target
|
|
all: build
|
|
|
|
# Install dependencies
|
|
install:
|
|
@echo "Installing frontend dependencies..."
|
|
cd web && npm install
|
|
|
|
# Development - start both backend and frontend
|
|
dev:
|
|
@echo "Starting development servers..."
|
|
@make dev-backend &
|
|
@sleep 3
|
|
@make dev-frontend
|
|
@wait
|
|
|
|
# Start backend only
|
|
dev-backend:
|
|
@echo "Starting Rust backend..."
|
|
cargo run -- gateway
|
|
|
|
# Start frontend only
|
|
dev-frontend:
|
|
@echo "Starting frontend dev server..."
|
|
cd web && npm run dev
|
|
|
|
# Build for production (frontend is built automatically by cargo via build.rs)
|
|
build:
|
|
@echo "Building PicoBot Web UI..."
|
|
cargo build --release
|
|
@echo "Build complete!"
|
|
|
|
# Run production build
|
|
run:
|
|
cargo run --release -- gateway
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
@echo "Cleaning build artifacts..."
|
|
rm -rf static/*
|
|
cd web && rm -rf dist node_modules
|
|
cargo clean
|
|
|
|
# Check code formatting and linting
|
|
check:
|
|
@echo "Checking formatting..."
|
|
cargo fmt --all -- --check
|
|
@echo "Checking frontend (lint + format + build)..."
|
|
cd web && npm run lint
|
|
cd web && npm run format:check
|
|
cd web && npm run build
|
|
@echo "Checking Rust code..."
|
|
cargo check
|
|
cargo clippy --all-targets --all-features
|
|
|
|
# Format all Rust code in place
|
|
fmt:
|
|
cargo fmt --all
|
|
|
|
# Auto-fix clippy lints where possible
|
|
fix:
|
|
cargo clippy --fix --all-targets --allow-dirty --allow-no-vcs
|
|
|
|
# Help
|
|
help:
|
|
@echo "PicoBot Web UI Makefile"
|
|
@echo ""
|
|
@echo "Available targets:"
|
|
@echo " make install - Install frontend dependencies"
|
|
@echo " make dev - Start both backend and frontend (development)"
|
|
@echo " make dev-backend - Start Rust backend only"
|
|
@echo " make dev-frontend - Start frontend dev server only"
|
|
@echo " make build - Build for production"
|
|
@echo " make run - Run production build"
|
|
@echo " make clean - Clean build artifacts"
|
|
@echo " make check - Check code formatting and linting"
|
|
@echo " make fmt - Format all Rust code in place"
|
|
@echo " make fix - Auto-fix clippy lints where possible"
|
|
@echo " make help - Show this help message"
|