-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (93 loc) · 3.18 KB
/
Copy pathMakefile
File metadata and controls
129 lines (93 loc) · 3.18 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
.PHONY: help install build clean dev start stop logs test lint typecheck migrate
# Default target
.DEFAULT_GOAL := help
# Variables
DOCKER_COMPOSE = docker-compose
NPM = npm
# Help command
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Installation and setup
install: ## Install all dependencies
$(NPM) install
clean: ## Clean all build artifacts and node_modules
rm -rf node_modules
rm -rf apps/*/node_modules packages/*/node_modules
rm -rf apps/*/dist packages/*/dist
rm -rf package-lock.json apps/*/package-lock.json packages/*/package-lock.json
# Build commands
build-dev: ## Build all packages and apps
$(NPM) run build
$(DOCKER_COMPOSE) -f docker-compose.dev.yml up --build
build-types: ## Build types package
$(NPM) run build --workspace=@dataflow/types
build-shared: ## Build shared package
$(NPM) run build --workspace=@dataflow/shared
build-api: ## Build API app
$(NPM) run build --workspace=@dataflow/api
build-web: ## Build web app
$(NPM) run build --workspace=@dataflow/web
# Development commands
dev: ## Start all services in development mode
$(DOCKER_COMPOSE) -f docker-compose.dev.yml up -d --build
$(NPM) run web:dev
dev-api: ## Start API in development mode
$(DOCKER_COMPOSE) up -d
dev-web: ## Start web app in development mode
$(NPM) run web:dev
# Docker commands
docker-build: ## Build Docker images
$(DOCKER_COMPOSE) build
docker-up: ## Start all Docker services
$(DOCKER_COMPOSE) up -d
docker-down: ## Stop all Docker services
$(DOCKER_COMPOSE) down
docker-restart: ## Restart all Docker services
$(DOCKER_COMPOSE) restart
docker-logs: ## View Docker logs
$(DOCKER_COMPOSE) logs -f
docker-logs-api: ## View API Docker logs
$(DOCKER_COMPOSE) logs -f api
docker-clean: ## Clean Docker volumes
$(DOCKER_COMPOSE) down -v
# Database commands
db-migrate: ## Run database migrations
$(NPM) run migration:run --workspace=@dataflow/api
db-migrate-generate: ## Generate a new migration
@read -p "Enter migration name: " name; \
$(NPM) run migration:generate --workspace=@dataflow/api -- "$$name"
db-migrate-revert: ## Revert last migration
$(NPM) run migration:revert --workspace=@dataflow/api
# Testing and quality
test: ## Run all tests
$(NPM) run test
test-api: ## Run API tests
$(NPM) run test --workspace=@dataflow/api
test-web: ## Run web tests
$(NPM) run test --workspace=@dataflow/web
lint: ## Run linter on all packages
$(NPM) run lint
typecheck: ## Run type checking on all packages
$(NPM) run typecheck
# Production commands
prod-build: ## Build for production
$(NPM) run build
$(DOCKER_COMPOSE) build api
prod-up: ## Start production services
$(DOCKER_COMPOSE) up -d
prod-down: ## Stop production services
$(DOCKER_COMPOSE) down
# Utility commands
logs: ## Show all logs
$(NPM) run dev 2>&1 | tee development.log
status: ## Show status of all services
$(DOCKER_COMPOSE) ps
shell-api: ## Open shell in API container
$(DOCKER_COMPOSE) exec api sh
shell-db: ## Open PostgreSQL shell
$(DOCKER_COMPOSE) exec postgres psql -U dataflow -d dataflow_db
redis-cli: ## Open Redis CLI
$(DOCKER_COMPOSE) exec redis redis-cli