2020-12-13 05:04:01 +00:00
|
|
|
CSS_DIR = themes/etch-custom/assets/css
|
2020-12-24 01:02:43 +00:00
|
|
|
DEVSERVER_URL="http://localhost:1313/"
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
DOMAIN = seirdy.one
|
|
|
|
HUGO_BASEURL = "https://$(DOMAIN)/"
|
|
|
|
USER = deploy@$(DOMAIN)
|
|
|
|
WWW_ROOT = /var/www/$(DOMAIN)
|
|
|
|
GEMINI_ROOT = /srv/gemini/$(DOMAIN)
|
2020-12-13 05:04:01 +00:00
|
|
|
|
|
|
|
WWW_RSYNC_DEST = $(USER):$(WWW_ROOT)
|
|
|
|
GEMINI_RSYNC_DEST = $(USER):$(GEMINI_ROOT)
|
|
|
|
|
2020-12-15 06:12:06 +00:00
|
|
|
OUTPUT_DIR = public
|
2020-12-13 05:16:40 +00:00
|
|
|
RSYNCFLAGS += -rlvz --zc=zstd
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: hugo
|
|
|
|
hugo: clean
|
|
|
|
hugo --gc -b $(HUGO_BASEURL)
|
2020-12-22 00:38:26 +00:00
|
|
|
|
2020-12-13 05:04:01 +00:00
|
|
|
# .hintrc-local for linting local files
|
|
|
|
# same as regular .hintrc but with a different connector.
|
|
|
|
.hintrc-local: .hintrc
|
|
|
|
jq --tab '.connector .name = "local" | del(.connector .options)' <.hintrc >.hintrc-local
|
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.hintrc-devserver: .hintrc
|
|
|
|
jq --tab '.extends = ["development"] | .hints["http-compression","https-only","ssllabs","sri"] = "off"' <.hintrc >.hintrc-devserver
|
|
|
|
|
|
|
|
.PHONY: clean
|
2020-12-13 05:04:01 +00:00
|
|
|
clean:
|
2020-12-24 01:02:43 +00:00
|
|
|
rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: lint-css
|
2020-12-13 05:04:01 +00:00
|
|
|
lint-css:
|
2020-12-24 01:02:43 +00:00
|
|
|
stylelint --di --rd --rdd $(CSS_DIR)/main.css $(CSS_DIR)/dark.css
|
|
|
|
csslint --quiet $(CSS_DIR)
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: hint
|
|
|
|
hint: hugo .hintrc-local
|
2020-12-13 05:04:01 +00:00
|
|
|
hint --config .hintrc-local -f codeframe $(OUTPUT_DIR)
|
2020-12-24 01:02:43 +00:00
|
|
|
rm .hintrc-local
|
|
|
|
|
|
|
|
.PHONY: lint-local
|
|
|
|
lint-local: lint-css hint
|
|
|
|
|
|
|
|
# dev server
|
|
|
|
.PHONY: serve
|
|
|
|
serve:
|
|
|
|
hugo serve --disableLiveReload
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: hint-devserver
|
|
|
|
hint-devserver: .hintrc-devserver
|
|
|
|
hint --config .hintrc-devserver -f codeframe $(DEVSERVER_URL)
|
|
|
|
rm .hintrc-devserver
|
|
|
|
|
|
|
|
.PHONY: check-links
|
2020-12-16 07:16:01 +00:00
|
|
|
check-links: hugo
|
2020-12-22 00:38:26 +00:00
|
|
|
lychee --verbose $(find public -type f -name '*.html' -o -name '*.gmi' -o -name '*.txt') content/posts/*.md content/posts/*.gmi
|
2020-12-15 06:12:06 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: test
|
|
|
|
test: lint-css hint-devserver check-links
|
2020-12-15 06:12:06 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: build
|
2020-12-13 05:04:01 +00:00
|
|
|
build: hugo
|
2020-12-13 06:07:00 +00:00
|
|
|
# gzip_static + max zopfli compression
|
2020-12-13 05:04:01 +00:00
|
|
|
ifndef NO_GZIP_STATIC
|
2020-12-19 02:32:55 +00:00
|
|
|
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' -o -name '*.webmanifest' \
|
2020-12-13 05:04:01 +00:00
|
|
|
| grep -v gemini \
|
2020-12-13 06:07:00 +00:00
|
|
|
| xargs zopfli --i50 --gzip
|
2020-12-13 05:04:01 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: deploy-html
|
|
|
|
deploy-html: build
|
2020-12-13 06:07:00 +00:00
|
|
|
rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete
|
2020-12-24 01:02:43 +00:00
|
|
|
|
|
|
|
.PHONY: deploy-gemini
|
|
|
|
deploy-gemini: hugo
|
|
|
|
rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude '*.gz' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.txt $(GEMINI_RSYNC_DEST)/ --delete
|
2020-12-13 06:07:00 +00:00
|
|
|
rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: deploy
|
|
|
|
deploy: deploy-html deploy-gemini
|
|
|
|
|
|
|
|
## stuff for the staging server
|
|
|
|
.PHONY: test-staging
|
|
|
|
test-staging: deploy-html
|
|
|
|
yq e '.ci .collect .url | .[]' .lighthouserc.yml | xargs hint -f codeframe
|
|
|
|
lhci autorun
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-24 01:02:43 +00:00
|
|
|
.PHONY: all
|
|
|
|
all: test deploy
|