-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
133 lines (110 loc) · 4.5 KB
/
Copy pathMakefile
File metadata and controls
133 lines (110 loc) · 4.5 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
.PHONY: setup setup-backend setup-frontend run dev-backend dev-frontend db-migrate lint lint-backend lint-frontend format format-backend format-frontend clean generate-types test test-backend test-frontend test-integration test-integration-ui
# Default target
help:
@echo "Draft - Development Commands"
@echo ""
@echo "Setup:"
@echo " make setup - Install all dependencies (frontend + backend)"
@echo " make setup-backend - Set up Python virtual environment and install dependencies"
@echo " make setup-frontend - Install Node.js dependencies"
@echo ""
@echo "Quick Start:"
@echo " make run - Start backend + frontend (2 processes)"
@echo " ./run.py - Alternative: run the launcher script directly"
@echo ""
@echo "Development (Manual):"
@echo " make dev-backend - Run FastAPI backend server (http://localhost:8000)"
@echo " make dev-frontend - Run Vite frontend dev server (http://localhost:5173)"
@echo ""
@echo "Database:"
@echo " make db-migrate - Run Alembic database migrations"
@echo ""
@echo "Testing:"
@echo " make test - Run all tests (backend + frontend)"
@echo " make test-backend - Run backend pytest tests"
@echo " make test-frontend - Run frontend vitest tests"
@echo " make test-integration - Run full-flow integration tests (requires 'make run')"
@echo " make test-integration-ui - Run integration tests with Playwright UI debugger"
@echo ""
@echo "Code Quality:"
@echo " make lint - Run linters for both frontend and backend"
@echo " make lint-backend - Run ruff linter on Python code"
@echo " make lint-frontend - Run ESLint on TypeScript code"
@echo " make format - Format code in both frontend and backend"
@echo " make format-backend - Format Python code with ruff"
@echo " make format-frontend- Format TypeScript code with Prettier"
@echo ""
@echo "Type Generation:"
@echo " make generate-types - Generate TypeScript types from backend OpenAPI spec"
@echo ""
@echo "Maintenance:"
@echo " make clean - Remove build artifacts and caches"
# Setup targets
setup: setup-backend setup-frontend
@echo "✓ Setup complete!"
setup-backend:
@echo "Setting up backend..."
cd backend && python3 -m venv venv
cd backend && . venv/bin/activate && pip install -r requirements-dev.txt
@echo "✓ Backend setup complete!"
setup-frontend:
@echo "Setting up frontend..."
cd frontend && npm install
@echo "✓ Frontend setup complete!"
# Quick start - backend + frontend (2 processes, no Redis needed)
run:
@echo "Starting Draft..."
@python3 run.py
# Development targets (manual)
dev-backend:
cd backend && . venv/bin/activate && uvicorn app.main:app --reload --reload-dir app --host 0.0.0.0 --port 8000
dev-frontend:
cd frontend && npm run dev
# Database targets
db-migrate:
cd backend && . venv/bin/activate && alembic upgrade head
# Lint targets
lint: lint-backend lint-frontend
lint-backend:
cd backend && . venv/bin/activate && ruff check .
lint-frontend:
cd frontend && npm run lint
# Format targets
format: format-backend format-frontend
format-backend:
cd backend && . venv/bin/activate && ruff format .
cd backend && . venv/bin/activate && ruff check --fix .
format-frontend:
cd frontend && npm run format
# Test targets
test: test-backend test-frontend
test-backend:
cd backend && . venv/bin/activate && pytest tests -v
test-frontend:
cd frontend && npx vitest run
test-integration:
cd frontend && npx playwright test --config playwright-integration.config.ts
test-integration-headed:
cd frontend && npx playwright test --config playwright-integration.config.ts --headed
test-integration-ui:
cd frontend && npx playwright test --config playwright-integration.config.ts --ui
# Type generation
generate-types:
@echo "Generating TypeScript types from OpenAPI spec..."
cd backend && (test -f venv/bin/activate && . venv/bin/activate; python scripts/extract_openapi.py /tmp/draft-openapi.json)
cd frontend && npx openapi-typescript /tmp/draft-openapi.json -o src/types/generated.ts
@rm -f /tmp/draft-openapi.json
@echo "Generated frontend/src/types/generated.ts"
# Clean targets
clean:
@echo "Cleaning build artifacts..."
rm -rf frontend/dist
rm -rf frontend/node_modules/.vite
rm -rf backend/__pycache__
rm -rf backend/app/__pycache__
rm -rf backend/.ruff_cache
rm -rf backend/.pytest_cache
rm -f backend/celerybeat-schedule*
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
@echo "✓ Clean complete!"