-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (51 loc) · 1.55 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
.PHONY: setup upgrade clean build pretty compress sync help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import webbrowser, sys
webbrowser.open(sys.argv[1])
endef
export BROWSER_PYSCRIPT
DESTDIR=public
BROWSER := python3 -c "$$BROWSER_PYSCRIPT"
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
setup: ## Setup site development mode.
@bun install
@git submodule update --init --recursive
@echo "Completed. Ready to serve. ✅"
upgrade: ## Upgrade bun packages.
@bun update
@echo "Completed. ✅"
clean: ## Clean old builds.
@echo "Cleaning old build. 🧹"
@if [ -d "$(DESTDIR)" ]; then \
cd $(DESTDIR) && rm -rf *; \
echo "It is shining. ✨"; \
else \
echo "Its already shining. ✨"; \
fi
build: ## Build minified version of site.
@echo "Generating site build. 🚧"
@hugo --gc --minify -d $(DESTDIR)
@echo "Site built successfully. ✅"
pretty: ## Format site using prettier.
@echo "Making your site beautiful. 🧹"
@bunx prettier --write .
@echo "Now, your site is pretty. ✨"
compress: ## Compress all .png files into .webp format.
@python3 cwebp.py
sync: ## Synchronize with the latest theme.
@echo "Synchronizing theme. 🔄"
@rm -rf themes/*
@git submodule update --init --recursive
@git submodule update --remote --merge
@echo "Completed. Ready to serve. ✅"
help: ## Help using make file.
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)