-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
131 lines (99 loc) · 5.59 KB
/
Copy pathMakefile
File metadata and controls
131 lines (99 loc) · 5.59 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# =============================================================================
# Auto-Bidder Makefile
# =============================================================================
# Core daily commands only. For the full command reference see:
# docs/makefile-commands.md
# =============================================================================
.DEFAULT_GOAL := help
# ─── Paths ──────────────────────────────────────────────────────────────────
BACKEND := backend
FRONTEND := frontend
VENV := $(BACKEND)/venv
# ─── Colors for help output ─────────────────────────────────────────────────
BLUE := \033[36m
GREEN := \033[32m
YELLOW := \033[33m
RESET := \033[0m
# =============================================================================
# Infrastructure (Docker)
# =============================================================================
infra-up: ## Start Docker services (PostgreSQL + ChromaDB)
docker-compose up -d
infra-down: ## Stop Docker services
docker-compose down
# =============================================================================
# Backend
# =============================================================================
backend-dev: ## Start backend dev server (uvicorn with hot-reload, port 5555)
cd $(BACKEND) && ../$(VENV)/bin/uvicorn app.main:app --reload --port 5555
backend-test: ## Run all backend tests
cd $(BACKEND) && $(VENV)/bin/pytest
backend-lint: ## Lint backend with ruff
cd $(BACKEND) && $(VENV)/bin/ruff check .
backend-format: ## Format backend with black
cd $(BACKEND) && $(VENV)/bin/black .
backend-typecheck: ## Run mypy type checking
cd $(BACKEND) && $(VENV)/bin/mypy app
backend-migrate: ## Apply database migrations
$(VENV)/bin/python $(BACKEND)/scripts/run_migrations.py
# =============================================================================
# Frontend
# =============================================================================
frontend-dev: ## Start frontend dev server (port 5556)
cd $(FRONTEND) && npm run dev -- --port 5556
frontend-lint: ## Lint frontend with ESLint
cd $(FRONTEND) && npm run lint
frontend-typecheck: ## TypeScript type checking
cd $(FRONTEND) && npm run type-check
# =============================================================================
# Combined / All-at-once
# =============================================================================
install: ## Install all dependencies (backend + frontend)
@if command -v uv &> /dev/null; then \
uv pip install -r $(BACKEND)/requirements.txt; \
else \
$(VENV)/bin/pip install -r $(BACKEND)/requirements.txt; \
fi
cd $(FRONTEND) && npm install
dev: ## Start all dev servers (backend + frontend concurrently)
@echo "$(YELLOW)Starting backend (port 5555) and frontend (port 5556)...$(RESET)"
@echo "$(YELLOW)Open http://localhost:5556 in your browser.$(RESET)"
@trap 'kill 0' EXIT; \
$(MAKE) backend-dev & \
$(MAKE) frontend-dev & \
wait
lint: backend-lint frontend-lint ## Lint both backend and frontend
format: backend-format ## Format backend code
typecheck: backend-typecheck frontend-typecheck ## Type check both projects
test: backend-test ## Run backend tests
clean: ## Clean build artifacts from both projects
find $(BACKEND) -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find $(BACKEND) -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
rm -rf $(BACKEND)/*.egg-info $(BACKEND)/.coverage $(BACKEND)/htmlcov
rm -rf $(FRONTEND)/.next
# =============================================================================
# Database
# =============================================================================
db-migrate: backend-migrate ## Apply database migrations (alias for backend-migrate)
db-psql: ## Open psql shell in the running postgres container
docker exec -it auto-bidder-postgres psql -U postgres -d auto_bidder_dev
# =============================================================================
# Health Check
# =============================================================================
health: ## Check backend health
curl -s http://localhost:5555/health | python3 -m json.tool || echo "$(YELLOW)Backend not running at :5555$(RESET)"
# =============================================================================
# Help
# =============================================================================
help: ## Show this help message
@printf "\n$(BLUE)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)\n"
@printf "$(BLUE) Auto-Bidder — Available Commands$(RESET)\n"
@printf "$(BLUE) Full reference: docs/makefile-commands.md$(RESET)\n"
@printf "$(BLUE)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)\n\n"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ":.*?## "}; \
{printf " $(GREEN)%-28s$(RESET) %s\n", $$1, $$2}'
@printf "\n$(BLUE)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)\n"
@printf " Quick start: $(YELLOW)make infra-up && make install && make dev$(RESET)\n"
@printf "$(BLUE)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)\n\n"