-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (45 loc) · 1.41 KB
/
Copy pathMakefile
File metadata and controls
60 lines (45 loc) · 1.41 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
.PHONY: dev css css-watch templ gen lint test verify migrate migrate-down migrate-status db-up db-down seed
# Database connection string (override with environment variable)
DATABASE_URL ?= postgres://postgres:postgres@localhost:5432/tfo_webapp_dev?sslmode=disable
# Development
dev: gen
tmux new-session -d -s tfo-webapp 'go run ./cmd/tfo-webapp' \; \
split-window -h 'make css-watch' \; \
attach
# Code generation
templ:
templ generate
gen: templ
# CSS
css:
npx @tailwindcss/cli -i web/static/input.css -o web/static/styles.css --minify
css-watch:
npx @tailwindcss/cli -i web/static/input.css -o web/static/styles.css --watch
# Validation
lint:
golangci-lint run ./...
test: gen
go test ./...
verify: gen css lint test
# Database migrations
migrate:
goose -dir db/migrations postgres "$(DATABASE_URL)" up
migrate-down:
goose -dir db/migrations postgres "$(DATABASE_URL)" down
migrate-status:
goose -dir db/migrations postgres "$(DATABASE_URL)" status
# Local database
db-up:
docker compose up -d db
db-down:
docker compose down
# Development seed data
# Populates the database with sample data for local development.
# WARNING: This truncates existing data. Only use in development.
#
# Usage:
# make db-up # Start the database
# make migrate # Run migrations
# make seed # Load sample data
seed:
docker exec -i tfo-webapp-db psql -U postgres -d tfo_webapp_dev < db/seed/dev_data.sql