forked from ajslater/codex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
254 lines (211 loc) · 4.7 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
SHELL := /usr/bin/env bash
.PHONY: activate
## Activate local virtual environment
## @category Env
activate:
source .venv/bin/activate
.PHONY: update
## Update dependencies
## @category Update
update:
./bin/update-deps.sh
.PHONY: update-builder
## Update builder requirements
## @category Update
update-builder:
./bin/update-builder-requirement.sh
## version
## @category Update
V :=
.PHONY: version
## Show or set project version
## @category Update
version:
bin/version.sh $(V)
.PHONY: install-backend-common
## Upgrade pip and poetry
## @category Install
install-backend-common:
BREW_PREFIX=$(brew --prefix)
export LDFLAGS="-L${BREW_PREFIX}/opt/openssl@3/lib"
export CPPFLAGS="-I${BREW_PREFIX}/opt/openssl@3/include"
export PKG_CONFIG_PATH="${BREW_PREFIX}/opt/openssl@3/lib/pkgconfig"
pip install --upgrade pip
pip install --upgrade poetry
npm install
.PHONY: install-frontend
## Install frontend
## @category Install
install-frontend:
cd frontend && make install
.PHONY: install
## Install for production
## @category Install
install: install-backend-common install-frontend
poetry install --no-root --sync
.PHONY: install-dev
## Install dev requirements
## @category Install
install-dev: install-backend-common install-frontend
poetry install --no-root --extras=dev --sync
.PHONY: install-all
## Install all extras
## @category Install
install-all: install-backend-common install-frontend
poetry install --no-root --all-extras --sync
.PHONY: fix-backend
## Fix only backend lint errors
## @category Fix
fix-backend:
./bin/fix-lint-backend.sh
.PHONY: fix-frontend
## Fix only frontend lint errors
## @category Fix
fix-frontend:
cd frontend && make fix
.PHONY: fix
## Fix front and back end lint errors
## @category Fix
fix: fix-frontend fix-backend
.PHONY: lint-backend
## Lint the backend
## @category Lint
lint-backend:
./bin/lint-backend.sh
.PHONY: lint-frontend
## Lint the frontend
## @category Lint
lint-frontend:
cd frontend && make lint
.PHONY: lint
## Lint front and back end
## @category Lint
lint: lint-frontend lint-backend
.PHONY: check
## Check django is ok
## @category Lint
check:
./bin/pm check
.PHONY: typecheck
## Static typecheck
## @category Lint
typecheck:
poetry run pyright .
.PHONY: test-backend
## Run backend tests
## @category Test
test-backend:
./bin/test-backend.sh
.PHONY: test-frontend
## Run frontend tests
## @category Test
test-frontend:
cd frontend && make test
.PHONY: test
## Run All Tests
## @category Test
test: test-frontend test-backend
.PHONY: benchmark-opds
## Time opds requests
## @category Test
benchmark-opds:
bin/benchmark-opds.sh
.PHONY: clean
## Clean pycaches
## @category Build
clean:
./bin/clean-pycache.sh
.PHONY: clean-frontend
## Clean static_build
## @category Build
clean-frontend:
cd frontend && make clean
.PHONY: build-frontend
## Build frontend
## @category Build
build-frontend: clean-frontend
cd frontend && make build
.PHONY: icons
## Build all icons from source
## @category Build
icons:
bin/icons_transform.py
.PHONY: collectstatic
## Collect static files for django
## @category Build
collectstatic:
bin/collectstatic.sh
.PHONY: build-backend
## Build python package
## @category Build
build-backend: collectstatic check
poetry build
.PHONY: build
## Build python package
## @category Build
build: build-frontend build-backend
.PHONY: choices
## Build JSON choices for frontend
## @category Build
choices:
./bin/build-choices.sh
.PHONY: kill
## Kill lingering codex processes
## @category Run Server
kill:
bin/kill-codex.sh || true
.PHONY: dev-server
## Run the dev webserver
## @category Run Server
dev-server: kill
./bin/dev-server.sh
.PHONY: dev-prod-server
## Run a bundled production webserver
## @category Run Server
dev-prod-server: build-frontend collectstatic
./bin/dev-prod-server.sh
.PHONY: dev-frontend-server
## Run the vite dev frontend
## @category Run Server
dev-frontend-server:
cd frontend && make dev-server
.PHONY: dev-ttabs
## Run the vite dev frontend and dev-server in ttabs
## @category Run Server
dev-ttabs:
./bin/dev-ttabs.sh
.PHONY: dev-reverse-proxy
## Run an nginx reverse proxy to codex in docker
## @category Run Server
dev-reverse-proxy:
./bin/dev-reverse-proxy.sh
.PHONY: dev-docker
## Restart codex in docker
## @category Run Server
dev-docker:
./bin/dev-docker.sh
## Module to run
## @category Run Server
M :=
.PHONY: dev-module
## Run a single codex module in dev mode
## @category Run Server
dev-module:
./bin/dev-module.sh $(M)
.PHONY: publish
## Publish package to pypi
## @category Deploy
publish:
./bin/pypi-deploy.sh
.PHONY: news
## Show recent NEWS
## @category Deploy
news:
head -40 NEWS.md
.PHONE: uml
## Create uml diagrams
## @category Dev
uml:
./bin/uml.sh
.PHONY: all
include bin/makefile-help.mk