-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
72 lines (50 loc) · 1.24 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
TROGON=./target/release/trogon
PSQL=psql -v ON_ERROR_STOP=1
WITH_ENV_DEV=env $$(xargs < .env)
WITH_ENV_PROD=env $$(xargs < .env.prod)
SHELL = bash -u
build: build-ui build-backend
build-ui:
cd ui && $(WITH_ENV_PROD) npm run build
build-backend:
cargo build --release
serve-prod:
$(WITH_ENV_PROD) cargo run --release
serve-ui:
cd ui && npm run serve
serve-backend:
$(WITH_ENV_DEV) cargo run
serve-backend-and-ui: build-ui serve-backend
test: test-ui
test-ui:
cd ui && npm test
test-ui-live:
cd ui && $(WITH_ENV_DEV) npx cypress open
deploy: build-ui
git checkout main
git add ui
git commit -m 'npm build'
git push
clean:
rm -fr ui/dist
psql:
$(PSQL) "$$TROGON_DB"
pgcli:
pgcli "$$TROGON_DB"
lint:
cargo clippy
format:
cd ui && zsh -c 'npx prettier --write * types/**/* src/**/*'
create-db:
echo "create database trogon" | $(PSQL)
create-db-schema:
$(PSQL) "$$TROGON_DB" < db.sql > /dev/null
load-ebird-species: build-backend
$(TROGON) --load-ebird-species
fetch-species-images: build-backend
$(TROGON) --fetch-species-images
delete-db:
@echo "echo 'drop database trogon' | $(PSQL)"
describe-db:
@echo "SELECT relname as table, n_live_tup as rows FROM pg_stat_user_tables ORDER BY n_live_tup DESC;" \
| $(PSQL) "$$TROGON_DB"