nicholaswilde_recipes/Taskfile.yaml
nιcнolaѕ wιlde 9b0641d03a
update
Signed-off-by: nιcнolaѕ wιlde <ncwilde43@gmail.com>
2024-11-12 12:53:33 -08:00

185 lines
5.1 KiB
YAML

---
version: '3'
vars:
ROOT_DIR:
sh: git rev-parse --show-toplevel
PORT: 8000
tasks:
build:
desc: Build mkdocs-material Dockerfile
cmds:
- docker build -t ghcr.io/nicholaswilde/mkdocs-material .
linkspector:
desc: linkspector
cmds:
- |
docker run --rm -it -v "${PWD}":/app -v "${PWD}"/.linkspector.yaml:/path/to/custom-config.yml \
--name linkspector umbrelladocs/linkspector bash -c 'linkspector check -c /path/to/custom-config.yml'
add-lazy-loading:
desc: Add lazy image loading
dir: '{{.USER_WORKING_DIR}}'
cmds:
- >-
sed -i 's/\(\!\[.*\)/\1\{ loading=lazy \}/' {{ .CLI_ARGS }}
add-comments:
desc: Add a front matter tag
cmds:
- >-
{{ .CMD }} '.comments = "true"' /workdir/{{ .CLI_ARGS }}
vars:
CMD: docker run --rm -v "${PWD}":/workdir mikefarah/yq --front-matter="process"
add-tag:
desc: Add a front matter tag
cmds:
- >-
{{ .CMD }} '.tags += ["{{ (split " " .CLI_ARGS)._0 }}"]' /workdir/{{ (split " " .CLI_ARGS)._1 }}
vars:
CMD: docker run --rm -v "${PWD}":/workdir mikefarah/yq -i --front-matter="process"
clean:
desc: Clean markdown files from cook dir
cmds:
- find cook -name "*.md" -delete
deps:
desc: Install dependencies
cmds:
- npm install --location=global spellchecker-cli
docker-update:
desc: Update docker images
cmds:
- docker image pull mikefarah/yq
- docker image pull squidfunk/mkdocs-material
- docker image pull 06kellyjac/markdownlint-cli
- docker image pull ghcr.io/tcort/markdown-link-check:stable
linkcheck:
desc: Check for dead links
cmds:
- ./scripts/linkcheck.sh
linkcheck-file:
desc: Link check a given file
cmds:
- >-
docker run --rm -v /:/tmp:ro -i -w /tmp ghcr.io/tcort/markdown-link-check:stable
"/tmp{{.f}}" -c "/tmp{{ .ROOT_DIR }}/mlc_config.json" || exit 1
vars:
f:
sh: "readlink -f {{shellQuote .FILE}}"
lint:
desc: Lint the project
cmds:
- task: markdownlint
- task: yamllint
list-ingredients:
desc: List all ingredients in all cook recipes and copy to clipboard.
cmds:
- ./scripts/list-ingredients.sh
markdownlint:
desc: Run markdownlint-cli
cmds:
- >-
docker run --rm -it -v ${PWD}:/markdown:ro
06kellyjac/markdownlint-cli .
markdownlint-fix:
desc: Run markdownlint-cli fix
cmds:
- >-
docker run --rm -it -v ${PWD}:/markdown:ro
06kellyjac/markdownlint-cli -f .
serve:
desc: >-
Start development server on http://0.0.0.0:{{ .PORT }} using
Docker and mkdocs-material
cmds:
- >-
docker run --rm -it -p {{ .PORT }}:{{ .PORT}} -v ${PWD}:/docs
--platform linux/amd64 ghcr.io/nicholaswilde/mkdocs-material serve
--dev-addr 0.0.0.0:{{ .PORT }} -f ./mkdocs.yml
serve-local:
desc: Serve a local mkdocs server
cmds:
- mkdocs serve
silent: true
server:
desc: Serve a cook server
cmds:
- cook server
silent: true
emoji:
desc: Show available emoji
cmds:
- yq '.emoji' includes/emoji.yaml
emoji-ing:
desc: Show available ingredients emoji
cmds:
- yq '.emoji.ingredients' includes/emoji.yaml
emoji-cw:
desc: Show available cookware emoji
cmds:
- yq '.emoji.cookware' includes/emoji.yaml
emoji-search:
desc: Search for emoji
cmds:
- yq '.emoji.ingredients[]|pick(["{{ .SHORTCODE }}"])|select(length>0)' includes/emoji.yaml
emoji-sort:
desc: Sort emoji.yaml
cmds:
- yq -i 'sort_keys(.emoji)' includes/emoji.yaml
- yq -i '.emoji.cookware|=sort_by(keys | .[0])' includes/emoji.yaml
- yq -i '.emoji.ingredients|=sort_by(keys | .[0])' includes/emoji.yaml
- yq includes/emoji.yaml
sort:
desc: Sort dictionary.txt
cmds:
- sort {{ .ROOT_DIR }}/dictionary.txt -u -o {{ .ROOT_DIR }}/dictionary.txt
spellcheck:
desc: Spellcheck cook files
cmds:
- npx spellchecker --config {{ .ROOT_DIR }}/.spellcheckerrc.yml
spellcheck-file:
desc: Spellcheck a single file
cmds:
- |
npx spellchecker -d {{ .ROOT_DIR }}/dictionary.txt -f {{shellQuote .f }} \
--config {{ .ROOT_DIR }}/.spellcheckerrc.yml
vars:
f:
sh: "readlink -f {{shellQuote .FILE}}"
commit:
desc: Commit new cook files, FILES.
cmds:
- cmd: ./scripts/commit.sh {{shellQuote .FILES }}
ignore_error: true
yamllint:
desc: Run yamllint
cmds:
- >-
docker run --rm -it -v ${PWD}:${PWD}:ro -w ${PWD}
programmerassistant/yamllint yamllint .
move:
desc: Move recipes markdown file and image, FILES.
cmds:
- ./scripts/move.sh {{shellQuote .FILES }}
deg:
desc: Replace temperatures with degree symbols
cmds:
- >-
sed -E -i -e 's/([[:digit:]]+)F/\1°F/'
-e 's/ degrees F/°F/'
-e 's/ degrees/°F/'
-e 's/([[:digit:]]+)[[:space:]]F/\1°F/' {{shellQuote .FILE }}
update:
desc: Update git submodules
cmds:
- "git submodule update --init --recursive --remote"
default:
cmds:
- task -a
silent: true