diff --git a/Makefile b/Makefile index b44c76a..c2f7f5f 100644 --- a/Makefile +++ b/Makefile @@ -9,65 +9,80 @@ SHELL := /bin/sh # so the targets work even when the shell's default Node is wrong. N := sh scripts/use-node.sh -.PHONY: help setup install env db-up db-down db-init migrate seed seed-dev \ - run build lint lint-fix test check doctor clean - +.PHONY: help help: ## List available targets @grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | sort \ | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}' +.PHONY: setup setup: install env db-init ## One-shot: install deps, create .env.local, start DB, migrate, seed @echo "Setup complete. Start the app with 'make run'." +.PHONY: install install: ## Install dependencies (also runs prisma generate) $(N) npm install +.PHONY: env env: ## Create .env.local from .env.example with generated secrets (no-op if it exists) @sh scripts/env-init.sh +.PHONY: db-up db-up: ## Start the local PostgreSQL container $(N) npm run db:up +.PHONY: db-down db-down: ## Stop the local database container $(N) npm run db:down +.PHONY: db-init db-init: ## Start DB, apply migrations, seed demo data (Docker required) $(N) npm run db:init +.PHONY: migrate migrate: ## Apply pending Prisma migrations $(N) npm run db:migrate +.PHONY: seed seed: ## Seed the base admin account $(N) npm run seed +.PHONY: seed-dev seed-dev: ## Seed demo data for development $(N) npm run seed:dev +.PHONY: run run: ## Run the dev server $(N) npm run dev +.PHONY: build build: ## Production build $(N) npm run build +.PHONY: lint lint: ## Lint $(N) npm run lint +.PHONY: lint-fix lint-fix: ## Lint and auto-fix $(N) npm run lint:fix +.PHONY: test test: ## Run the test suite $(N) npm test +.PHONY: check check: ## Run the same gates CI enforces (lint, types, schema, build) $(N) npm run lint -- --max-warnings 0 $(N) npx tsc --noEmit $(N) npx prisma validate $(N) npm run build +.PHONY: doctor doctor: ## Full setup diagnosis with optional auto-fix (toolchain, env, Docker, DB, Prisma) @sh scripts/doctor.sh +.PHONY: clean clean: ## Stop the DB and remove node_modules and the Next.js build cache $(N) npm run db:down rm -rf node_modules .next