-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
105 lines (84 loc) · 2.11 KB
/
Makefile
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
95
96
97
98
99
100
101
102
103
104
105
.DEFAULT_GOAL := build-all
export PROJECT := "geoip"
export PACKAGE := "github.com/lrstanley/geoip"
license:
curl -sL https://liam.sh/-/gh/g/license-header.sh | bash -s
up: prepare go-up node-up
@echo
prepare: clean node-prepare node-build go-prepare
@echo
build-all: prepare go-build
@echo
clean:
/bin/rm -rfv "public/dist/*" ${PROJECT}
docker-build:
docker build \
--pull \
--tag ${PROJECT} \
--force-rm .
# frontend
node-fetch:
command -v pnpm >/dev/null >&2 || npm install \
--no-audit \
--no-fund \
--quiet \
--global pnpm
cd public; pnpm install
node-up:
cd public && \
pnpm up -i
node-prepare: node-fetch
cd public; pnpm exec openapi \
--input ../internal/handlers/apihandler/openapi_v2.yaml \
--output src/lib/api/openapi/ \
--client fetch \
--useOptions \
--indent 2 \
--name HTTPClient
node-lint: node-build # needed to generate eslint auto-import ignores.
cd public; pnpm exec eslint \
--ignore-path ../.gitignore \
--ext .js,.ts,.vue .
node-test: node-prepare
if [ -n "${CI}" ];then "output=${PWD}/public/tests/results/" >> "${GITHUB_OUTPUT}";fi
cd public; if [ -n "${CI}" ];then pnpm exec playwright install;fi
cd public; pnpm exec playwright test
node-debug: node-prepare
cd public; pnpm exec vite
node-build: node-prepare
cd public; pnpm exec vite build
node-preview: node-build
cd public; pnpm exec vite preview
# backend
go-fetch:
go mod download
go mod tidy
go-up:
go get -u ./...
go mod tidy
go-prepare: go-fetch
go generate -x ./...
{ echo '## :gear: Usage'; go run ${PACKAGE} --generate-markdown --db.license-key ""; } > USAGE.md
go-dlv: go-prepare
dlv debug \
--headless --listen=:2345 \
--api-version=2 --log \
--allow-non-terminal-interactive \
${PACKAGE} -- --debug
go-debug: go-prepare
go run ${PACKAGE} \
--http.limit 1000000 \
--http.max-concurrent 0 \
--http.metrics \
--dns.resolver "8.8.8.8" \
--dns.resolver "1.1.1.1" \
--debug
go-build: go-prepare
CGO_ENABLED=0 \
go build \
-ldflags '-d -s -w -extldflags=-static' \
-tags=netgo,osusergo,static_build \
-installsuffix netgo \
-trimpath \
-o ${PROJECT} \
${PACKAGE}