-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (42 loc) · 1.34 KB
/
Copy pathMakefile
File metadata and controls
57 lines (42 loc) · 1.34 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
.PHONY: all build build-web build-go test test-go test-web typecheck run dev-visitor dev-inbox deps clean
BINARY := freesupp
GO_LDFLAGS := -s -w
all: build
## build: build both frontends, then the binary with the assets embedded
build: build-web build-go
build-web:
cd web/visitor && npm run build
cd web/inbox && npm run build
build-go:
CGO_ENABLED=0 go build -trimpath -ldflags '$(GO_LDFLAGS)' -o $(BINARY) ./cmd/freesupp
## test: Go tests plus both Vitest suites
test: test-go test-web
test-go:
go test ./...
test-web:
cd web/visitor && npm test
cd web/inbox && npm test
typecheck:
cd web/visitor && npm run typecheck
cd web/inbox && npm run typecheck
## run: local dev server on :8080 serving the last built assets.
## No SMTP or Turnstile: mail is logged, the captcha is skipped.
## The first visit to the inbox creates the first admin account.
BASE_URL ?= http://localhost:8080
DB_PATH ?= ./freesupp.db
SESSION_SECRET ?= dev-secret-not-for-production
run:
BASE_URL='$(BASE_URL)' DB_PATH='$(DB_PATH)' \
SESSION_SECRET='$(SESSION_SECRET)' \
go run ./cmd/freesupp
## dev-visitor / dev-inbox: Vite dev servers proxying the API to :8080
dev-visitor:
cd web/visitor && npm run dev
dev-inbox:
cd web/inbox && npm run dev
deps:
cd web/visitor && npm ci
cd web/inbox && npm ci
clean:
rm -f $(BINARY)
rm -rf web/visitor/dist web/inbox/dist