-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
70 lines (56 loc) · 1.98 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
SHELL := /bin/bash
.PHONY: help
help: ## This help message
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
.PHONY: clean-img
clean-img: ## Remove autogenerated image files
rm -rf public/
rm -f static/**/*.avif
rm -f static/**/*.webp
.PHONY: clean-pub
clean-pub: ## Remove build files
rm -rf public/
rm -f static/tinysearch_engine*
.PHONY: clean
clean: clean-pub clean-img ## Remove public files and images
.PHONY: versions
versions: ## Show versions of tools
zola --version
gh-stats --version
tinysearch --version
wasm-opt --version
terser --version
wasm-opt --version
cavif --version
convert -version
cwebp -version
.PHONY: content
content: ## Build the content of the static site with zola
zola build
.PHONY: images
images: ## Create webp and avif images
cargo run --manifest-path ./helpers/img/Cargo.toml
# Creating a temporary directory here because wasm-pack seems to overwrite
# the public output directory. Haven't yet found the reason why.
.PHONY: index
index: content ## Build the search index with tinysearch
mkdir -p tinysearch_out
RUST_LOG=debug tinysearch --optimize --path tinysearch_out public/json/index.html
mv tinysearch_out/* public
rm -rf tinysearch_out
.PHONY: minify
minify: ## Compress JavaScript assets
terser --compress --mangle --output public/search_min.js -- static/search.mjs public/tinysearch_engine.js
.PHONY: build
build: stars content index minify ## Build static site and search index, minify JS
.PHONY: build-quick
build-quick: content ## Build static site
.PHONY: dev run serve
dev run serve: ## Serve website locally
zola serve --drafts
.PHONY: stars
stars: ## Update Github stars statistics for my projects
gh-stats --filter gitpod --stars 100 --template .star-counter-template.md --output content/static/about/stars.md
.PHONY: deploy publish
deploy publish: clean-pub build ## Deploy site on Cloudflare's Workers Sites using wrangler
wrangler publish