From 41c821747ea4c1ee475e48a9c56756a4df37305b Mon Sep 17 00:00:00 2001 From: Jon Gear Date: Thu, 1 Jan 2026 11:23:50 -0800 Subject: [PATCH] feat: add Makefile with comprehensive development commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds convenient Make shortcuts for common development tasks: Development: - make install/dev/build/serve - Standard workflow commands Code Quality: - make lint/lint-fix/test - Linting and testing Maintenance: - make clean/clean-all/fresh/rebuild - Cleanup utilities Dependencies: - make audit/audit-fix/upgrade - Dependency management Utilities: - make version/info/help - Project information All commands include color-coded output for better UX. Updated README with comprehensive Makefile documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- Makefile | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 46 +++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a488089 --- /dev/null +++ b/Makefile @@ -0,0 +1,87 @@ +.PHONY: help install dev build lint serve clean test audit + +# Default target +.DEFAULT_GOAL := help + +# Colors for output +CYAN := \033[0;36m +GREEN := \033[0;32m +YELLOW := \033[0;33m +RED := \033[0;31m +NC := \033[0m # No Color + +help: ## Show this help message + @echo "$(CYAN)Available commands:$(NC)" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-15s$(NC) %s\n", $$1, $$2}' + +install: ## Install dependencies + @echo "$(CYAN)Installing dependencies...$(NC)" + npm install + +ci-install: ## Clean install for CI/CD (uses package-lock.json) + @echo "$(CYAN)Running clean install...$(NC)" + npm ci + +dev: ## Start development server + @echo "$(CYAN)Starting development server...$(NC)" + npm run dev + +start: dev ## Alias for dev + +build: ## Build production site + @echo "$(CYAN)Building production site...$(NC)" + npm run build + +lint: ## Run ESLint + @echo "$(CYAN)Running linter...$(NC)" + npm run lint + +lint-fix: ## Run ESLint with auto-fix + @echo "$(CYAN)Running linter with auto-fix...$(NC)" + npm run lint:fix + +serve: ## Serve production build locally + @echo "$(CYAN)Serving production build...$(NC)" + npm run serve + +clean: ## Clean build artifacts and node_modules + @echo "$(CYAN)Cleaning build artifacts...$(NC)" + rm -rf public .cache + @echo "$(GREEN)Build artifacts cleaned!$(NC)" + +clean-all: clean ## Clean everything including node_modules + @echo "$(CYAN)Removing node_modules...$(NC)" + rm -rf node_modules package-lock.json + @echo "$(GREEN)All artifacts cleaned!$(NC)" + +audit: ## Run npm security audit + @echo "$(CYAN)Running security audit...$(NC)" + npm audit + +audit-fix: ## Fix npm security issues automatically + @echo "$(CYAN)Fixing security issues...$(NC)" + npm audit fix + +test: lint build ## Run all tests (lint + build) + @echo "$(GREEN)All tests passed!$(NC)" + +fresh: clean-all install ## Fresh install (clean + install) + @echo "$(GREEN)Fresh install complete!$(NC)" + +rebuild: clean build ## Clean rebuild + @echo "$(GREEN)Rebuild complete!$(NC)" + +upgrade: ## Update all dependencies to latest versions + @echo "$(YELLOW)Updating dependencies...$(NC)" + npm update + @echo "$(GREEN)Dependencies updated!$(NC)" + +version: ## Show current version from package.json + @node -p "'v' + require('./package.json').version" + +info: ## Show project information + @echo "$(CYAN)Project Information:$(NC)" + @echo " Name: $$(node -p "require('./package.json').name")" + @echo " Version: $$(node -p "require('./package.json').version")" + @echo " Node: $$(node --version)" + @echo " NPM: $$(npm --version)" diff --git a/README.md b/README.md index e0020fb..57d0eab 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,52 @@ The site will be available at `http://localhost:8000` - `npm run lint` - Run ESLint - `npm run serve` - Serve the production build locally +### Makefile Commands + +For convenience, common tasks are available via Make commands. Run `make help` to see all available commands: + +```sh +make help +``` + +#### Quick Reference + +**Development:** +```sh +make install # Install dependencies +make dev # Start development server (alias: make start) +make build # Build production site +make serve # Serve production build locally +``` + +**Code Quality:** +```sh +make lint # Run ESLint +make lint-fix # Auto-fix linting issues +make test # Run all tests (lint + build) +``` + +**Maintenance:** +```sh +make clean # Clean build artifacts (.cache, public) +make clean-all # Clean everything including node_modules +make fresh # Fresh install (clean-all + install) +make rebuild # Clean rebuild (clean + build) +``` + +**Dependencies:** +```sh +make audit # Run npm security audit +make audit-fix # Auto-fix security issues +make upgrade # Update all dependencies +``` + +**Utilities:** +```sh +make version # Show current version +make info # Show project information +``` + ## Deployment My site uses a comprehensive CI/CD pipeline with [GitHub Actions](https://docs.github.com/en/actions) and [Netlify](https://www.netlify.com/):