-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
195 lines (152 loc) · 5.89 KB
/
Copy pathMakefile
File metadata and controls
195 lines (152 loc) · 5.89 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
.PHONY: help install dev build test lint clean docker-up docker-down version version-patch version-minor version-major
# Default target
help:
@echo "AWS Infrastructure Visualizer - Development Commands"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " install Install all dependencies (backend + frontend)"
@echo " dev Start development servers (backend + frontend)"
@echo " build Build production artifacts"
@echo " test Run all tests"
@echo " lint Run linters"
@echo " clean Remove build artifacts and caches"
@echo ""
@echo "Docker:"
@echo " docker-up Start all services with Docker Compose"
@echo " docker-down Stop all Docker services"
@echo " docker-build Build Docker images"
@echo ""
@echo "Backend:"
@echo " backend-install Install backend dependencies"
@echo " backend-dev Start backend dev server"
@echo " backend-test Run backend tests"
@echo " backend-lint Lint backend code"
@echo ""
@echo "Frontend:"
@echo " frontend-install Install frontend dependencies"
@echo " frontend-dev Start frontend dev server"
@echo " frontend-test Run frontend tests"
@echo " frontend-lint Lint frontend code"
@echo ""
@echo "Database:"
@echo " db-init Initialize database and create tables"
@echo " db-reset Reset database (drops all data)"
@echo " db-seed Seed database with sample data"
@echo " db-setup Initialize and seed database"
@echo ""
@echo "Versioning:"
@echo " version Show current version"
@echo " version-patch Bump patch version (1.0.0 -> 1.0.1)"
@echo " version-minor Bump minor version (1.0.0 -> 1.1.0)"
@echo " version-major Bump major version (1.0.0 -> 2.0.0)"
# =============================================================================
# Combined Commands
# =============================================================================
install: backend-install frontend-install
@echo "All dependencies installed"
dev:
@echo "Starting development servers..."
@make -j2 backend-dev frontend-dev
build: backend-build frontend-build
@echo "Build complete"
test: backend-test frontend-test
@echo "All tests passed"
lint: backend-lint frontend-lint
@echo "Linting complete"
clean:
@echo "Cleaning build artifacts..."
rm -rf backend/__pycache__ backend/.pytest_cache backend/.coverage
rm -rf frontend/dist frontend/node_modules/.cache
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@echo "Clean complete"
# =============================================================================
# Docker Commands
# =============================================================================
docker-up:
docker-compose up -d
@echo "Services started. API: http://localhost:8000, Frontend: http://localhost:3000"
docker-down:
docker-compose down
docker-build:
docker-compose build
docker-logs:
docker-compose logs -f
# =============================================================================
# Backend Commands
# =============================================================================
backend-install:
cd backend && pip install -r requirements.txt -r requirements-dev.txt
backend-dev:
cd backend && uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
backend-test:
cd backend && pytest -v
backend-lint:
cd backend && black --check app/ tests/
cd backend && isort --check-only app/ tests/
cd backend && flake8 app/ tests/
backend-format:
cd backend && black app/ tests/
cd backend && isort app/ tests/
backend-build:
cd backend && docker build -t aws-infra-visualizer-backend .
# =============================================================================
# Frontend Commands
# =============================================================================
frontend-install:
cd frontend && npm install
frontend-dev:
cd frontend && npm run dev
frontend-test:
cd frontend && npm test
frontend-lint:
cd frontend && npm run lint
frontend-format:
cd frontend && npm run format
frontend-build:
cd frontend && npm run build
# =============================================================================
# Database Commands
# =============================================================================
db-init:
@echo "Initializing database..."
cd backend && python -m scripts.init_db
db-reset:
@echo "Resetting database..."
cd backend && python -m scripts.reset_db
db-seed:
@echo "Seeding database with sample data..."
cd backend && python -m scripts.seed_db
db-setup: db-init db-seed
@echo "Database setup complete"
# =============================================================================
# Infrastructure Commands
# =============================================================================
tf-init:
cd infrastructure/environments/$(ENV) && terraform init
tf-plan:
cd infrastructure/environments/$(ENV) && terraform plan
tf-apply:
cd infrastructure/environments/$(ENV) && terraform apply
tf-destroy:
cd infrastructure/environments/$(ENV) && terraform destroy
# =============================================================================
# Versioning Commands
# =============================================================================
VERSION_FILE := VERSION
CURRENT_VERSION := $(shell cat $(VERSION_FILE) 2>/dev/null || echo "0.0.0")
MAJOR := $(word 1,$(subst ., ,$(CURRENT_VERSION)))
MINOR := $(word 2,$(subst ., ,$(CURRENT_VERSION)))
PATCH := $(word 3,$(subst ., ,$(CURRENT_VERSION)))
version:
@echo "Current version: $(CURRENT_VERSION)"
version-patch:
@echo "$(MAJOR).$(MINOR).$(shell echo $$(($(PATCH)+1)))" > $(VERSION_FILE)
@echo "Version bumped: $(CURRENT_VERSION) -> $$(cat $(VERSION_FILE))"
version-minor:
@echo "$(MAJOR).$(shell echo $$(($(MINOR)+1))).0" > $(VERSION_FILE)
@echo "Version bumped: $(CURRENT_VERSION) -> $$(cat $(VERSION_FILE))"
version-major:
@echo "$(shell echo $$(($(MAJOR)+1))).0.0" > $(VERSION_FILE)
@echo "Version bumped: $(CURRENT_VERSION) -> $$(cat $(VERSION_FILE))"