Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (64 loc) · 2.42 KB
/
Copy pathMakefile
File metadata and controls
94 lines (64 loc) · 2.42 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
GO_PACKAGES := ./cmd/... ./internal/...
DATABASE_URL ?= postgres://wealthboard:wealthboard@localhost:5433/wealthboard?sslmode=disable
.PHONY: generate lint typecheck test build migrate-check security test-e2e test-e2e-go go-fmt go-generate go-test go-test-integration go-vet go-run migrate migrate-status backup restore seed-demo postgres-up postgres-down web-install web-generate web-dev web-lint web-typecheck web-test web-build
generate: go-generate web-generate
lint: go-fmt go-vet web-lint
typecheck: web-typecheck
test: go-test web-test
node scripts/validate-pwa-static.mjs
build: web-build
mkdir -p bin
go build -trimpath -o bin/wealthboard ./cmd/wealthboard
migrate-check:
TEST_DATABASE_URL="$(DATABASE_URL)" go test ./internal/database -run '^TestPostgreSQLMigrations$$' -count=1
security:
go run golang.org/x/vuln/cmd/govulncheck@latest $(GO_PACKAGES)
npm audit --audit-level=high
npm --prefix web audit --audit-level=high
test-e2e: test-e2e-go
test-e2e-go:
npm run test:e2e:go
go-fmt:
test -z "$$(gofmt -l cmd db/postgres internal)"
go-generate:
go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.31.1 generate
go-test:
go test $(GO_PACKAGES) ./db/postgres/...
go-test-integration:
TEST_DATABASE_URL="$(DATABASE_URL)" go test ./internal/database ./internal/auth ./internal/service ./internal/operator -count=1
go-vet:
go vet $(GO_PACKAGES)
go-run:
DATABASE_URL="$(DATABASE_URL)" go run ./cmd/wealthboard serve
migrate:
DATABASE_URL="$(DATABASE_URL)" go run ./cmd/wealthboard migrate
migrate-status:
DATABASE_URL="$(DATABASE_URL)" go run ./cmd/wealthboard migrate-status
backup:
test -n "$(BACKUP_FILE)"
DATABASE_URL="$(DATABASE_URL)" go run ./cmd/wealthboard backup --file "$(BACKUP_FILE)"
restore:
test -n "$(RESTORE_FILE)"
DATABASE_URL="$(DATABASE_URL)" go run ./cmd/wealthboard restore --file "$(RESTORE_FILE)" --confirm-maintenance
seed-demo:
test "$(DEMO_DATA)" = "true"
test -n "$(TARGET_USERNAME)"
DATABASE_URL="$(DATABASE_URL)" DEMO_DATA=true go run ./cmd/wealthboard seed-demo --username "$(TARGET_USERNAME)"
postgres-up:
docker compose -f docker-compose.go.yml up -d postgres
postgres-down:
docker compose -f docker-compose.go.yml down
web-install:
npm --prefix web install
web-generate:
npm --prefix web run generate:api
web-dev:
npm --prefix web run dev
web-lint:
npm --prefix web run lint
web-typecheck:
npm --prefix web run typecheck
web-test:
npm --prefix web test
web-build:
npm --prefix web run build