snippetmakefileModeratepending
Makefile patterns -- task runner for any project
Viewed 0 times
Makefilemaketask runnerPHONYself-documenting
terminallinuxmacos
Problem
Projects need common commands that developers remember differently. README instructions get outdated.
Solution
Use Makefile as a universal task runner. Self-documenting with a help target.
Code Snippets
Self-documenting Makefile
.PHONY: help build test lint dev clean deploy
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
build: ## Build
npm run build
test: ## Run tests
npm test
deploy: build test ## Deploy (runs build + test first)
./scripts/deploy.sh
.DEFAULT_GOAL := helpRevisions (0)
No revisions yet.