-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (36 loc) · 2.22 KB
/
Copy pathMakefile
File metadata and controls
52 lines (36 loc) · 2.22 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
# ─── Variables ────────────────────────────────────────────────
DATABASE_URL ?= postgres://basedock:basedock@localhost:5432/basedock?sslmode=disable
# ─── Infrastructure ──────────────────────────────────────────
.PHONY: db-up db-down
db-up: ## Start PostgreSQL
docker compose -f compose.dev.yml up -d
db-down: ## Stop PostgreSQL
docker compose -f compose.dev.yml down
# ─── Code Generation (Ent) ──────────────────────────────────
.PHONY: generate
generate: ## Generate Go code from Ent schemas
cd api && go generate ./ent
# ─── API Server ──────────────────────────────────────────────
.PHONY: api-run api-dev api-build api-test
api-run: ## Run the API server
cd api && go run ./cmd/server
api-dev: ## Run with hot-reload (requires air)
cd api && air
api-build: ## Build the API binary
cd api && go build -o ../bin/basedock-api ./cmd/server
api-test: ## Run Go tests
cd api && go test ./...
# ─── OpenAPI ─────────────────────────────────────────────────
.PHONY: openapi
openapi: ## Generate OpenAPI spec into web/
cd api && go run ./cmd/openapi ../web/openapi.json
# ─── Combined ────────────────────────────────────────────────
.PHONY: setup
setup: db-up generate ## Full setup: DB + codegen (auto-migration runs on server start)
@echo "Setup complete. Run 'make api-run' to start the server."
# ─── Help ────────────────────────────────────────────────────
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help