-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (87 loc) · 2.87 KB
/
Makefile
File metadata and controls
102 lines (87 loc) · 2.87 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
.PHONY: help sync sync-hotspot install dev dev-api dev-cms stop-dev test test-api test-cms audit
.DEFAULT_GOAL := help
HOTSPOT ?= 0
UV_SYNC_GROUP_ARGS :=
ifeq ($(HOTSPOT),1)
UV_SYNC_GROUP_ARGS += --group hotspot
endif
help:
@echo "Videofy Minimal - Make commands"
@echo ""
@echo "Usage:"
@echo " make <target> [VAR=value]"
@echo ""
@echo "Targets:"
@echo " help Show this help output"
@echo " sync Install Python dependencies (HOTSPOT=1 includes hotspot deps)"
@echo " sync-hotspot Install only hotspot Python dependency group"
@echo " install Install npm dependencies"
@echo " dev-api Start API server on :8001"
@echo " dev-cms Start CMS dev server on :3000"
@echo " dev Start API + CMS together"
@echo " stop-dev Stop local listeners on ports 8001 and 3000"
@echo " test-api Run Python tests"
@echo " test-cms Run CMS typecheck and build"
@echo " test Run all tests"
@echo " audit Run npm audit (critical)"
@echo ""
@echo "Options:"
@echo " HOTSPOT=1 Include hotspot dependencies in sync/dev"
@echo ""
@echo "Examples:"
@echo " make dev"
@echo " make dev HOTSPOT=1"
sync:
uv sync $(UV_SYNC_GROUP_ARGS)
sync-hotspot:
uv sync --group hotspot
install:
npm install
dev-api: sync
uv run uvicorn api.main:app --reload --host 0.0.0.0 --port 8001
dev-cms: install
npm run dev:cms
dev: sync install
@set -e; \
trap 'kill $$api_pid $$cms_pid 2>/dev/null || true' EXIT INT TERM; \
if lsof -ti tcp:8001 -sTCP:LISTEN >/dev/null 2>&1; then \
api_existing_pid=$$(lsof -ti tcp:8001 -sTCP:LISTEN | head -n1); \
echo "Error: API port 8001 is already in use by pid=$$api_existing_pid."; \
echo "Run 'make stop-dev' to clear stale local dev processes."; \
exit 1; \
else \
uv run uvicorn api.main:app --reload --host 0.0.0.0 --port 8001 & \
api_pid=$$!; \
fi; \
if lsof -ti tcp:3000 -sTCP:LISTEN >/dev/null 2>&1; then \
cms_existing_pid=$$(lsof -ti tcp:3000 -sTCP:LISTEN | head -n1); \
echo "Error: CMS port 3000 is already in use by pid=$$cms_existing_pid."; \
echo "Run 'make stop-dev' to clear stale local dev processes."; \
exit 1; \
fi; \
npm run dev:cms & \
cms_pid=$$!; \
wait $$api_pid $$cms_pid
stop-dev:
@api_pids=$$(lsof -ti tcp:8001 -sTCP:LISTEN 2>/dev/null || true); \
cms_pids=$$(lsof -ti tcp:3000 -sTCP:LISTEN 2>/dev/null || true); \
if [ -n "$$api_pids" ]; then \
echo "Stopping API listener(s) on 8001: $$api_pids"; \
kill $$api_pids 2>/dev/null || true; \
else \
echo "No API listener on 8001"; \
fi; \
if [ -n "$$cms_pids" ]; then \
echo "Stopping CMS listener(s) on 3000: $$cms_pids"; \
kill $$cms_pids 2>/dev/null || true; \
else \
echo "No CMS listener on 3000"; \
fi
test-api: sync
uv run pytest -q
test-cms: install
npm run check-types:cms
npm run build:cms
test: test-api test-cms
audit: install
npm audit --audit-level=critical