-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (117 loc) · 4.29 KB
/
Makefile
File metadata and controls
148 lines (117 loc) · 4.29 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
.PHONY: all build run dev clean test lint help
.PHONY: backend-build backend-run backend-dev backend-test backend-lint
.PHONY: frontend-build frontend-run frontend-dev frontend-lint
.PHONY: docker-build docker-up docker-down
# Default target
all: build
# =============================================================================
# Main Commands
# =============================================================================
## build: Build both frontend and backend (production binary)
build:
./build.sh
## run: Run the production binary
run: build
./codesentry
## dev: Run both frontend and backend in development mode (requires two terminals)
dev:
@echo "Run these commands in separate terminals:"
@echo " make backend-dev # Terminal 1"
@echo " make frontend-dev # Terminal 2"
## clean: Clean build artifacts
clean:
rm -f codesentry
rm -rf frontend/dist
rm -rf backend/tmp
## test: Run all tests
test: backend-test
## lint: Run all linters
lint: backend-lint frontend-lint
# =============================================================================
# Backend Commands
# =============================================================================
## backend-build: Build the backend binary
backend-build:
cd backend && go build -o ../codesentry ./cmd/server
## backend-run: Run the backend server
backend-run:
cd backend && go run ./cmd/server
## backend-dev: Run backend with hot reload (requires air)
backend-dev:
cd backend && air
## backend-test: Run backend tests
backend-test:
cd backend && go test ./...
## backend-lint: Run backend linters
backend-lint:
cd backend && go vet ./...
@which golangci-lint > /dev/null && cd backend && golangci-lint run || echo "golangci-lint not installed, skipping"
## backend-tidy: Tidy Go modules
backend-tidy:
cd backend && go mod tidy
# =============================================================================
# Frontend Commands
# =============================================================================
## frontend-build: Build the frontend for production
frontend-build:
cd frontend && npm run build
## frontend-dev: Run frontend development server
frontend-dev:
cd frontend && npm run dev
## frontend-lint: Run frontend linter
frontend-lint:
cd frontend && npm run lint
## frontend-install: Install frontend dependencies
frontend-install:
cd frontend && npm install
# =============================================================================
# Docker Commands
# =============================================================================
## docker-build: Build Docker image
docker-build:
docker build -t codesentry:latest .
## docker-up: Start with Docker Compose (MySQL)
docker-up:
docker-compose up -d
## docker-up-sqlite: Start with Docker Compose (SQLite)
docker-up-sqlite:
docker-compose -f docker-compose.sqlite.yml up -d
## docker-up-postgres: Start with Docker Compose (PostgreSQL)
docker-up-postgres:
docker-compose -f docker-compose.postgres.yml up -d
## docker-down: Stop Docker Compose
docker-down:
docker-compose down
## docker-logs: Show Docker Compose logs
docker-logs:
docker-compose logs -f
# =============================================================================
# Database Commands
# =============================================================================
## db-reset: Reset the database (SQLite only, development)
db-reset:
rm -f backend/data/codesentry.db
@echo "Database reset. Run 'make backend-run' to recreate."
# =============================================================================
# Help
# =============================================================================
## help: Show this help message
help:
@echo "CodeSentry - AI-powered Code Review Platform"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Main Commands:"
@grep -E '^## ' $(MAKEFILE_LIST) | grep -E '(build|run|dev|clean|test|lint):' | sed 's/## / /' | column -t -s ':'
@echo ""
@echo "Backend Commands:"
@grep -E '^## backend' $(MAKEFILE_LIST) | sed 's/## / /' | column -t -s ':'
@echo ""
@echo "Frontend Commands:"
@grep -E '^## frontend' $(MAKEFILE_LIST) | sed 's/## / /' | column -t -s ':'
@echo ""
@echo "Docker Commands:"
@grep -E '^## docker' $(MAKEFILE_LIST) | sed 's/## / /' | column -t -s ':'
@echo ""
@echo "Database Commands:"
@grep -E '^## db' $(MAKEFILE_LIST) | sed 's/## / /' | column -t -s ':'