-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (51 loc) · 1.65 KB
/
Makefile
File metadata and controls
61 lines (51 loc) · 1.65 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
SHELL := /bin/bash
# Detect package managers
HAS_BUN := $(shell command -v bun >/dev/null 2>&1 && echo 1 || echo 0)
HAS_NPM := $(shell command -v npm >/dev/null 2>&1 && echo 1 || echo 0)
.PHONY: setup build dev dev-backend dev-frontend test docker clean
setup:
@echo "[setup] Installing backend deps..." && \
cd backend && go mod download
@echo "[setup] Installing frontend deps..." && \
if [ $(HAS_BUN) -eq 1 ]; then \
(cd frontend && bun install); \
else \
if [ $(HAS_NPM) -eq 1 ]; then \
(cd frontend/apps/web && npm ci); \
else \
echo "No bun or npm found. Please install bun (recommended) or npm." && exit 1; \
fi; \
fi
build:
@echo "[build] Building backend..." && \
cd backend && CGO_ENABLED=0 go build -o bin/api ./cmd/api
@echo "[build] Building frontend..." && \
if [ $(HAS_BUN) -eq 1 ]; then \
(cd frontend && bun run build); \
else \
(cd frontend/apps/web && npm run build); \
fi
dev:
@echo "[dev] Starting backend and frontend concurrently…" && \
$(MAKE) -j 2 dev-backend dev-frontend
dev-backend:
@echo "[dev-backend] Starting Go API..." && \
cd backend && ENV=dev go run ./cmd/api
dev-frontend:
@echo "[dev-frontend] Starting Next.js app..." && \
if [ $(HAS_BUN) -eq 1 ]; then \
(cd frontend && bun run dev:web); \
else \
(cd frontend/apps/web && npm run dev); \
fi
test:
@echo "[test] Running backend tests..." && \
cd backend && go test ./...
docker:
@echo "[docker] Building full stack images…" && \
docker compose build
clean:
@echo "[clean] Cleaning build artifacts…" && \
rm -rf backend/bin || true && \
(cd frontend/apps/web && rm -rf .next) || true && \
cd backend && go clean -testcache