-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) · 1.77 KB
/
Copy pathMakefile
File metadata and controls
41 lines (32 loc) · 1.77 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
.PHONY: setup start stop logs clean reset psql help
.ONESHELL:
# Detect docker compose command: v2 plugin or v1 standalone
DC := $(shell docker compose version >/dev/null 2>&1 && echo "docker compose" || echo "docker-compose")
help: ## Show available commands
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-10s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
setup: ## Full first-time setup: start DB, run migrations, launch backend + frontend
@bash "$(CURDIR)/setup.sh"
start: ## Start DB + backend + Angular/React watchers + frontend (skips migrations — run setup first)
$(DC) -f "$(CURDIR)/docker-compose.yml" up -d db
cd "$(CURDIR)/server" && npm start &
SERVER_PID=$$!
cd "$(CURDIR)/client-angular" && npm run watch &
ANGULAR_PID=$$!
cd "$(CURDIR)/client-react" && npm run watch &
REACT_PID=$$!
trap 'kill $$SERVER_PID $$ANGULAR_PID $$REACT_PID 2>/dev/null || true' EXIT
cd "$(CURDIR)/client" && npx vite
stop: ## Stop the DB container (preserves data; use 'clean' to also remove the DB)
$(DC) -f "$(CURDIR)/docker-compose.yml" stop
-pkill -f "ts-node src/main.ts" 2>/dev/null || true
logs: ## Stream database container logs
$(DC) -f "$(CURDIR)/docker-compose.yml" logs -f db
clean: ## Remove containers, volumes, and node_modules
$(DC) -f "$(CURDIR)/docker-compose.yml" down -v --remove-orphans
-pkill -f "ts-node src/main.ts" 2>/dev/null || true
rm -rf "$(CURDIR)/server/node_modules" "$(CURDIR)/client/node_modules"
rm -rf "$(CURDIR)/client-angular/node_modules" "$(CURDIR)/client-angular/dist"
rm -rf "$(CURDIR)/client-react/node_modules" "$(CURDIR)/client-react/dist"
reset: clean setup ## Full teardown then setup (clean restart)
psql: ## Open a psql session in the running PostgreSQL container
$(DC) -f "$(CURDIR)/docker-compose.yml" exec db psql -U tickets tickets