-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (60 loc) · 3.8 KB
/
Copy pathMakefile
File metadata and controls
88 lines (60 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.PHONY: help up down build logs shell-backend shell-frontend test test-backend test-frontend test-e2e lint format migrate
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# ─── App lifecycle ─────────────────────────────────────────────────────────────
up: ## Start all services (dev)
docker compose up --build
up-d: ## Start all services in background
docker compose up --build -d
down: ## Stop and remove containers
docker compose down
build: ## Rebuild images without cache
docker compose build --no-cache
logs: ## Tail all service logs
docker compose logs -f
logs-backend: ## Tail backend logs
docker compose logs -f backend
logs-frontend: ## Tail frontend logs
docker compose logs -f frontend
# ─── Shells ────────────────────────────────────────────────────────────────────
shell-backend: ## Open bash in backend container
docker compose exec backend bash
shell-frontend: ## Open sh in frontend container
docker compose exec frontend sh
shell-db: ## Open psql in db container
docker compose exec db psql -U $${DB_USER:-notes_user} $${DB_NAME:-notes_db}
# ─── Testing ───────────────────────────────────────────────────────────────────
test: test-backend test-frontend ## Run all unit tests
test-backend: ## Run backend pytest suite
docker compose run --rm backend pytest -v
test-frontend: ## Run frontend Jest suite
docker compose exec frontend npm test
test-e2e: ## Run Playwright end-to-end tests (app must be running)
docker compose --profile e2e run --rm playwright
test-coverage: ## Run backend tests with coverage report
docker compose run --rm backend pytest --cov --cov-report=term-missing
# ─── Linting & formatting ──────────────────────────────────────────────────────
lint: lint-backend lint-frontend ## Run all linters
lint-backend: ## Run flake8 + isort check on backend
docker compose run --rm backend sh -c "flake8 . && isort --check-only ."
lint-frontend: ## Run ESLint on frontend
docker compose exec frontend npm run lint
format: format-backend ## Auto-format all code
format-backend: ## Run black + isort on backend
docker compose run --rm backend sh -c "black . && isort ."
typecheck: ## Run TypeScript type check
docker compose exec frontend npm run typecheck
# ─── Django ────────────────────────────────────────────────────────────────────
migrate: ## Run Django migrations
docker compose exec backend python manage.py migrate
makemigrations: ## Generate new Django migrations
docker compose exec backend python manage.py makemigrations
createsuperuser: ## Create Django superuser
docker compose exec backend python manage.py createsuperuser
# ─── Production ────────────────────────────────────────────────────────────────
prod-up: ## Start production stack
docker compose -f docker-compose.production.yml up --build -d
prod-down: ## Stop production stack
docker compose -f docker-compose.production.yml down
prod-logs: ## Tail production logs
docker compose -f docker-compose.production.yml logs -f