|
1 |
| -define PRINT_STEP |
2 |
| - @echo "$$(tput setaf 6)$$(tput bold)\n:> $1\n$$(tput sgr0)" |
3 |
| -endef |
| 1 | +SHELL := /bin/bash -ex |
| 2 | +MAKEFLAGS += --silent |
4 | 3 |
|
5 | 4 | # Define packages as a space-separated list
|
6 | 5 | BREW_PACKAGES := gh hugo pre-commit prettier [email protected] uv
|
7 | 6 |
|
8 |
| -init: |
9 |
| - @git submodule update --init --recursive |
10 |
| - @npm install |
11 | 7 |
|
12 |
| -ifeq ($(CI),) |
13 |
| - @$(call PRINT_STEP,installing brew dependencies) |
14 |
| - @for pkg in $(BREW_PACKAGES); do \ |
15 |
| - brew list $$pkg &>/dev/null || (echo "Installing $$pkg..." && brew install $$pkg); \ |
| 8 | +init: |
| 9 | + git submodule update --init --recursive |
| 10 | + npm install |
| 11 | + npm install -g wrangler |
| 12 | + for pkg in $(BREW_PACKAGES); do \ |
| 13 | + brew list $$pkg &>/dev/null || brew install $$pkg; \ |
16 | 14 | done
|
17 |
| - |
18 |
| - @$(call PRINT_STEP,creating python venv) |
19 |
| - @uv venv -p 3.12 |
20 |
| - |
21 |
| - @$(call PRINT_STEP,installing python dependencies) |
22 |
| - @. .venv/bin/activate |
23 |
| - @uv pip install black blacken-docs mypy pytest pytest-cov ruff |
24 |
| - |
25 |
| - @$(call PRINT_STEP,initialization complete) |
26 |
| -endif |
27 |
| - |
| 15 | + uv venv -p 3.12 |
| 16 | + . .venv/bin/activate |
| 17 | + uv pip install black blacken-docs mypy pytest pytest-cov ruff |
28 | 18 |
|
29 | 19 | lint:
|
30 |
| - @pre-commit run --all-files |
31 |
| - @prettier --write . |
32 |
| - |
| 20 | + pre-commit run --all-files |
| 21 | + prettier --write . |
33 | 22 |
|
34 | 23 | update:
|
35 |
| - @git submodule update --remote --merge |
36 |
| - @pre-commit autoupdate -j 4 |
37 |
| - @npm update |
38 |
| - |
| 24 | + git submodule update --remote --merge |
| 25 | + pre-commit autoupdate -j 4 |
| 26 | + npm update |
39 | 27 |
|
40 | 28 | devserver:
|
41 |
| - @hugo server --disableFastRender -e production --bind 0.0.0.0 --ignoreCache |
| 29 | + hugo server --disableFastRender -e production --bind 0.0.0.0 --ignoreCache |
| 30 | + |
| 31 | +upload-static: |
| 32 | + find static -type f | while read filepath; do \ |
| 33 | + key=$$(echo "$$filepath" | sed 's|^|blog/|'); \ |
| 34 | + wrangler r2 object put $$key --file "$$filepath"; \ |
| 35 | + done |
0 commit comments