-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 1.67 KB
/
Copy pathMakefile
File metadata and controls
62 lines (47 loc) · 1.67 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
.PHONY: dev dev-backend dev-frontend db migrate lint install install-hooks generate-client stop restart
# Start everything
dev:
$(MAKE) -j3 db dev-backend dev-frontend
db:
docker compose up -d postgres
dev-backend:
cd backend && PYTHONPATH=. uvicorn app.main:app --reload --port 8001
dev-frontend:
cd frontend && npm run dev -- --port 3001
install:
cd backend && pip install -e ".[dev]"
cd frontend && npm install
install-hooks:
pre-commit install
# Regenerate frontend TypeScript types from the FastAPI OpenAPI spec.
# Run after changes to backend Pydantic schemas. The output file is
# committed so LLMs and tests can rely on it without running the
# generator. CI doesn't run this — drift gets caught at next manual
# regen + the resulting tsc errors.
generate-client:
cd backend && DEBUG=true PYTHONPATH=. python scripts/dump_openapi.py > /tmp/baseplate-openapi.json
cd frontend && npx openapi-typescript /tmp/baseplate-openapi.json -o src/lib/api-types.ts
rm -f /tmp/baseplate-openapi.json
migrate:
cd backend && PYTHONPATH=. alembic upgrade head
migrate-new:
cd backend && PYTHONPATH=. alembic revision --autogenerate -m "$(msg)"
lint:
cd backend && ruff check app/ tests/
cd frontend && npx tsc --noEmit
cd frontend && npm run lint
test-backend:
cd backend && PYTHONPATH=. pytest -v
test-frontend:
cd frontend && npx vitest run
# Stop all services
stop:
-pkill -f "uvicorn app.main:app" 2>/dev/null
-pkill -f "next dev.*--port 3001" 2>/dev/null
docker compose down
# Restart everything
restart: stop
sleep 1
$(MAKE) dev
hash-password:
@python -c "import bcrypt, getpass; print(bcrypt.hashpw(getpass.getpass('Password: ').encode(), bcrypt.gensalt()).decode())"