-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTaskfile.yaml
184 lines (176 loc) · 5.14 KB
/
Taskfile.yaml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
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