1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-12-24 17:52:11 +00:00

Add fflint checks

See https://www.fflint.dev/ and https://github.com/FileFormatInfo/fflint
This commit is contained in:
Seirdy 2024-07-14 01:19:03 -04:00
parent df5516a476
commit 5a4da5f818
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 25 additions and 3 deletions

View file

@ -97,10 +97,14 @@ html-validate:
.validate-feed-notes:
scripts/bin/validate-feed file://$(PWD)/$(OUTPUT_DIR)/notes/atom.xml
validate-feeds: .validate-feed-main .validate-feed-posts .validate-feed-notes
.PHONY: validate-feeds .validate-feed-main .validate-feed-posts .validate-feed-notes
fflint: hugo
sh scripts/fflint.sh $(OUTPUT_DIR)
.PHONY: validate-feeds .validate-feed-main .validate-feed-posts .validate-feed-notes fflint
.PHONY: lint-local
lint-local: html-validate validate-html validate-json htmlproofer validate-feeds
lint-local: fflint htmlproofer validate-feeds validate-json html-validate validate-html
# dev server, includes future and draft posts
.PHONY: serve
@ -195,5 +199,5 @@ lint-and-deploy-staging:
deploy-envs:
@$(MAKE) HUGO_FLAGS='--gc --ignoreCache' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs xhtmlize
@$(MAKE) HUGO_FLAGS='--gc --ignoreCache' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs copy-to-xhtml
@$(MAKE) HUGO_FLAGS='' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs validate-html html-validate validate-json validate-feeds
@$(MAKE) HUGO_FLAGS='' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs fflint validate-json validate-feeds validate-html html-validate
@$(MAKE) SSHFLAGS='-o KexAlgorithms=curve25519-sha256@libssh.org' HUGO_FLAGS='' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs deploy

18
scripts/fflint.sh Normal file
View file

@ -0,0 +1,18 @@
#!/bin/sh
#fflint json --show-tests all --show-detail "$output_dir/**/*.json"
set -e -u
output_dir="$1"
fflint_wrapper() {
fflint --fail-fast --progress=false --show-tests failing $*
}
cd "$output_dir"
find '.' -type f -name "*.jpg" | fflint_wrapper --height 1-1500 --width 1-1500 jpeg @-
find '.' -type f -name "*.png" | fflint_wrapper --height 1-1500 --width 1-1500 png @-
find '.' -type f -name "*.json" -o -name ".webmanifest" | fflint_wrapper json @-
find '.' -type f -name "*.html" | fflint_wrapper html @-
find '.' -type f -name "*.svg" | fflint_wrapper --height 1-1500 --width 1-1500 svg @-
find '.' -type f -name "*.txt" -o -name "*.gmi" -o -name "*.asc" | fflint_wrapper text @-
find '.' -type f -name "*.xhtml" -o -name "*.xml" | fflint_wrapper xml @-