-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (38 loc) · 1.43 KB
/
Copy pathMakefile
File metadata and controls
47 lines (38 loc) · 1.43 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
45
46
47
# Make all the rules since we don't use make as a build tool
.PHONY: $(MAKECMDGOALS)
SHELL := /bin/bash -ex
MAKEFLAGS += --silent
BREW_PACKAGES := gh hugo prettier
WRANGLER_VERSION := 4.83.0
WRANGLER := npx -y wrangler@$(WRANGLER_VERSION)
init:
for pkg in $(BREW_PACKAGES); do \
brew list $$pkg &>/dev/null || brew install $$pkg; \
done
uvx pre-commit install
format:
go run ./scripts/lintcodeblocks
git status --porcelain -u | awk '{print $$2}' | xargs -r uvx pre-commit run --files
git status --porcelain -u | awk '{print $$2}' | grep '.md' | xargs -n 1 prettier --write
update:
uvx pre-commit autoupdate -j 4
dev:
hugo --environment production --minify --gc --cleanDestinationDir
npx -y pagefind
hugo server --disableFastRender -e production --bind 0.0.0.0 --ignoreCache
build:
hugo --environment production --minify --gc --cleanDestinationDir
npx -y pagefind
test: build
go test -v -count=1 ./...
upload-image:
@if [ -z "$(local_path)" ] || [ -z "$(remote_path)" ]; then \
echo "Usage: make upload-image local_path=<file> remote_path=<bucket_path>"; \
echo ""; \
echo "Examples:"; \
echo " make upload-image local_path=static/images/transparent.png remote_path=blog/static/images/transparent.png"; \
echo " make upload-image local_path=content/images/cover.png remote_path=blog/static/images/home/cover.png"; \
exit 1; \
fi
oxipng -o 6 $(local_path)
$(WRANGLER) r2 object put $(remote_path) --file $(local_path) --remote