-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (55 loc) · 3.32 KB
/
Makefile
File metadata and controls
79 lines (55 loc) · 3.32 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
# path: Makefile
# Common developer tasks.
# Usage: make <target>
# Requires: Docker, docker-compose, Node ≥18, npm ≥9
.PHONY: help build-etl-image run-etl dev test-etl lint-etl clean db-up db-down db-shell demo deploy deploy-prod
DEFAULT_GOAL := help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*##"}{printf " \033[36m%-20s\033[0m %s\n",$$1,$$2}'
# ── Docker / ETL ─────────────────────────────────────────────────────────────
db-up: ## Start PostGIS in the background
docker compose up -d postgis
db-down: ## Stop and remove PostGIS container (data persisted in .pgdata/)
docker compose stop postgis
db-shell: ## psql shell into the local PostGIS DB
docker compose exec postgis psql -U nyrr -d nyroadreport
build-etl-image: ## Build the ETL Docker image (do this after requirements change)
docker compose build etl
run-etl: db-up ## Run full ETL pipeline; outputs artifacts to frontend/public/data/
@mkdir -p etl/downloads frontend/public/data
docker compose run --rm etl bash /app/etl/run_all.sh
run-etl-step: ## Run a single ETL step; e.g. make run-etl-step STEP=etl/04_parse_contacts.py
@mkdir -p etl/downloads frontend/public/data
docker compose run --rm etl python $(STEP)
# ── Frontend ─────────────────────────────────────────────────────────────────
install: ## Install frontend npm dependencies
cd frontend && npm install
dev: install ## Start the Vite dev server (hot-reload)
cd frontend && npm run dev
build-frontend: install ## Production Vite build
cd frontend && npm run build
preview: build-frontend ## Preview the production build locally
cd frontend && npm run preview
demo: ## Start local demo with sample Schenectady data (no Docker, tippecanoe, or ETL needed)
@echo "Fetching real OSM road geometries and writing demo fixtures..."
node demo/build_demo_geojson.js
@echo "Launching dev server at http://localhost:5173 ..."
cd frontend && VITE_DEMO_MODE=true npm run dev
deploy: ## Build & push a draft deploy to Netlify (unique URL, permanent)
./deploy.sh
deploy-prod: ## Build & push to Netlify + update the stable production URL
./deploy.sh --prod
# ── Quality ──────────────────────────────────────────────────────────────────
lint-etl: ## Ruff lint on all ETL Python files
docker compose run --rm etl ruff check /app/etl
test-etl: ## Run minimal ETL unit tests
docker compose run --rm etl pytest /app/etl/tests -v
lint-frontend: ## ESLint + TypeScript check
cd frontend && npm run lint
# ── Clean ─────────────────────────────────────────────────────────────────────
clean: ## Remove generated artifacts and Docker volumes (keeps downloads cache)
rm -rf frontend/public/data/*.pmtiles \
frontend/public/data/contacts_lookup.json \
frontend/public/data/build_meta.json \
etl/tmp
docker compose down -v