-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjustfile
More file actions
132 lines (102 loc) · 2.92 KB
/
justfile
File metadata and controls
132 lines (102 loc) · 2.92 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
set quiet
export CGO_ENABLED := '0'
export PORT := '8080'
export DATABASE := 'tmp/archded.db'
[private]
default:
just --list
# first-time setup: install dependencies, build and fetch data
init: install build-assets build-templates update-data
# install dependencies
install:
go mod download
pnpm install
# compile frontend assets
build-assets:
pnpm run build
# generate Go code and templ templates
build-templates:
go generate ./...
go tool templ generate
# build the production binary
build: build-assets build-templates
go build -tags production -o archded -ldflags="-s -w" -trimpath
# run the application locally
run:
go run -tags development .
# open the local dev server in the default browser
open:
xdg-open 'http://localhost:{{ PORT }}'
# watch for template and Go changes and rebuild automatically
[parallel]
dev: dev-assets dev-server
[private]
dev-assets:
pnpm exec vite build --watch
[private]
dev-server:
air
# run all tests
test:
go test ./...
# run all linters
lint:
pnpm run lint
golangci-lint run
just --fmt --unstable --check
# auto-format all code
fmt:
pnpm run format
go tool templ fmt .
golangci-lint fmt
just --fmt --unstable
# remove all untracked and ignored files
clean:
git clean -fdqx -e .idea
# remove untracked files, reinstall dependencies and rebuild
rebuild: clean install build-assets build-templates
# list outdated direct dependencies
outdated:
pnpm outdated
go list -u -m -json all | jq -r 'select(.Update and (.Indirect | not)) | "\(.Path): \(.Version) -> \(.Update.Version)"'
# audit dependencies for known vulnerabilities
audit:
pnpm audit --prod
# update Go toolchain and module dependencies
update-go:
go mod edit -go=$(go env GOVERSION | sed 's/go//; s/-.*//')
go get -u ./...
go mod tidy
go get -u -t all
go mod tidy
# update pnpm dependencies
update-pnpm:
pnpm update --latest
# update all dependencies to latest versions
update: update-go update-pnpm
# fetch all external data into the local database
update-data: update-packages update-news update-mirrors update-releases update-package-popularities update-mirror-popularities
# fetch package data from Arch Linux repositories
update-packages:
go run . update-packages
# fetch news from archlinux.org
update-news:
go run . update-news
# fetch mirror list from archlinux.org
update-mirrors:
go run . update-mirrors
# fetch release data from archlinux.org
update-releases:
go run . update-releases
# fetch package popularity data from pkgstats.archlinux.de
update-package-popularities:
go run . update-package-popularities
# fetch mirror popularity data from pkgstats.archlinux.de
update-mirror-popularities:
go run . update-mirror-popularities
# generate test coverage report
coverage:
#!/usr/bin/env bash
set -euo pipefail
go test -coverpkg=./... -coverprofile coverage.out ./...
go tool cover -func=coverage.out