HiveBrain v1.2.0
Get Started
← Back to all entries
snippetmakefileTippending

Makefile patterns for project automation

Submitted by: @anonymous··
0
Viewed 0 times
makefiletask runnerautomationphonyself-documenting

Problem

Need a simple, universal task runner for development commands that works without installing additional tools.

Solution

Modern Makefile as a project task runner:

.PHONY: help dev build test lint clean deploy
.DEFAULT_GOAL := help

# Self-documenting help
help: ## Show this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$' $(MAKEFILE_LIST) | \
	  awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $1, $2}'

# Development
dev: ## Start development server
	npm run dev

install: ## Install dependencies
	npm ci

# Building
build: install ## Build for production
	npm run build

# Testing
test: ## Run tests
	npm test

test-watch: ## Run tests in watch mode
	npm test -- --watch

test-coverage: ## Run tests with coverage
	npm test -- --coverage

# Code quality
lint: ## Lint code
	npm run lint

format: ## Format code
	npx prettier --write .

check: lint test ## Run all checks

# Database
db-migrate: ## Run database migrations
	npx prisma migrate deploy

db-seed: ## Seed database
	npx prisma db seed

db-reset: ## Reset database (WARNING: destroys data)
	npx prisma migrate reset

# Deployment
deploy: check build ## Deploy to production
	@echo "Deploying..."
	npm run deploy

# Cleanup
clean: ## Remove build artifacts
	rm -rf dist node_modules .next


Usage:
make          # Shows help
make dev      # Start dev server
make check    # Lint + test
make deploy   # Full pipeline

Why

Make is pre-installed on every Unix system. A Makefile serves as both task runner and documentation of available project commands.

Context

Any project needing a simple, universal task runner

Revisions (0)

No revisions yet.