-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
138 lines (96 loc) · 2.82 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
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
133
134
135
136
137
138
.PHONY: build test
MAKEFLAGS += --silent
## docker setup ubuntu
install-docker:
sh script/docker/install.sh
## install
install:
pnpm i --frozen-lockfile
generate-local-database-type:
pnpm supabase gen types typescript --local > src/api/database/supabase/type.ts
generate-type-for-ci:
make copy-env-testing &&\
make start-testing-database &&\
make migrate-up &&\
make generate-typesafe-environment &&\
make generate-local-database-type
## telemetry
opt-out-telemetry:
pnpm next telemetry disable
## env
generate-typesafe-environment:
pnpm vite-node script/env/type-def.ts
copy-env:
cp config/.env.${environment} .env
copy-env-development:
make copy-env environment="development" && cp supabase/config/normal.toml supabase/config.toml
copy-env-testing:
make copy-env environment="testing" && cp supabase/config/test.toml supabase/config.toml
copy-env-production:
make copy-env environment="production"
## generate
generate: generate-webmanifest generate-sitemap
generate-webmanifest:
pnpm vite-node script/site/webmanifest.ts
generate-sitemap:
pnpm next-sitemap
# database resest
migrate-up:
pnpm supabase migration up
database-push:
pnpm supabase db-push
reset-database:
pnpm supabase db reset && make generate-typesafe-environment && make generate-local-database-type
restart-database:
pnpm supabase stop && pnpm supabase start
start-testing-database:
pnpm supabase stop && make copy-env-testing && pnpm supabase start
start-development-database:
pnpm supabase stop && make copy-env-development && pnpm supabase start
## deployment
pre-deploy-production: copy-env-production build-production
clear-cache:
rm -rf .next
# development
start-development: copy-env-development clear-cache dev
start-testing: copy-env-testing clear-cache dev
start-production: copy-env-production clear-cache dev
## build
build-development: copy-env-development clear-cache build
build-production: copy-env-production clear-cache build generate
build-testing: copy-env-testing clear-cache build
build:
pnpm next build
## start
start:
pnpm next start $(arguments)
## dev
dev:
pnpm next dev
## format
format:
pnpm prettier --$(type) .
format-check:
make format type=check
format-write:
make format type=write && pnpm vite-node script/formatter/sql.ts
## lint
lint:
pnpm eslint . --color && pnpm knip
## typecheck
typecheck:
pnpm tsc -p tsconfig.json $(arguments)
## test
test-type:
pnpm vitest test/$(path)/**.test.ts $(arguments)
test-unit:
pnpm vitest test/unit/**/**.test.ts $(arguments)
test-integration: copy-env-testing
make test-type path="integration" arguments="$(arguments)"
test-snapshot:
make test-type path="snapshot" arguments="$(arguments)"
pretest-ci:
node node_modules/puppeteer/install.mjs
kill-server:
pnpm vite-node script/test/kill-server.ts
test: build-testing test-unit test-integration test-snapshot