Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (33 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
44 lines (33 loc) · 1.71 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
.DEFAULT_GOAL := help
# The scripts that are not an app of their own. The apps (dashboard, insuit, ip-service)
# have their own Makefile, package.json and checks; .oxfmtrc.json here is shared by all.
SCRIPTS := authelia .cli
.PHONY: help
help: ## show this help
@awk 'BEGIN {FS = ":.*##"; print "usage: make <target>\n"} \
/^##@/ { printf "\n\033[1m%s:\033[0m\n", substr($$0, 5); next } \
/^[a-zA-Z0-9_.-]+:.*##/ { printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
##@ Scripts outside the apps
.PHONY: install format format-check lint typecheck test qa
install: ## install the Bun types, oxfmt and oxlint
@bun install --frozen-lockfile --ignore-scripts >/dev/null
format: install ## format the scripts with oxfmt
@bun x oxfmt $(SCRIPTS)
format-check: install ## fail on a script oxfmt would change
@bun x oxfmt --check $(SCRIPTS)
lint: install ## lint the scripts with oxlint
@bun x oxlint $(SCRIPTS)
typecheck: install ## type-check the scripts
@bun check --no-pretty $(SCRIPTS)
test: install ## run the scripts' tests
@bun test $(addprefix ./,$(SCRIPTS))
qa: format-check lint typecheck test ## everything CI runs on the scripts
##@ Migrations on the boxes
.PHONY: migrate
# The Pi unless told otherwise. Every box gets every migration; each says which boxes run it.
# They land in the ssh user's home, so always the same user per box: containers on the Pi,
# root on the pollos boxes. Another user would keep its own record and run them all again.
BOX ?= containers@nas.local
migrate: ## copy the migrations to BOX (default the Pi) and run the ones it has not run yet
git ls-files -z .cli/migrations ':!*.test.ts' | rsync -a --from0 --files-from=- ./ $(BOX):
ssh $(BOX) 'bun .cli/migrations/tool/migrate.ts run'