-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile.toml
248 lines (198 loc) · 7.37 KB
/
Makefile.toml
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# Make using this repo easy with https://github.com/sagiegurari/cargo-make#installation
#
# See all insluded task with:
# makers --list-all-steps
[config]
# Catch errors and report to try and help user
on_error_task = "catch-error"
# Skip loading of all core tasks which saves up a bit on toml parsing and task creation
# Also makse minimal listing of included tasks: https://github.com/sagiegurari/cargo-make#disabling-predefined-tasksflows
skip_core_tasks = true
# Skips loading Git related environment variables
skip_git_env_info = true
# Skips loading rust related environment variables
skip_rust_env_info = true
# Skips loading the current crate related environment variables
skip_crate_env_info = true
[tasks.default]
alias = "serve"
dependencies = ["check-install"]
# -----------------------------------------------------------------------------
# Installation
[tasks.i]
category = "Install"
alias = "install"
[tasks.id]
category = "Install"
alias = "install-dev"
[tasks.ia]
category = "Install"
alias = "install-all"
[tasks.install-all]
description = "Install all dependencies for slides and book tooling, and dev tools."
category = "Install"
dependencies = ["install", "install-dev"]
[tasks.install]
description = "Install dependencies for slides and book tooling."
category = "Install"
dependencies = ["install-slides", "install-book"]
[tasks.install-book]
description = "Install dependencies for building the book only."
category = "Install"
script = "cargo install --locked mdbook"
[tasks.install-slides]
description = "Install dependencies for slides tooling only."
category = "Install"
script = '''
if ! $(echo "type bun" | sh > /dev/null ); then
echo "🥟 Installing https://bun.sh ..."
curl -fsSL https://bun.sh/install | bash
fi
echo "💽 Bun installed. NOTE: you may need to update your shell to include this, see above output."
echo "🥟 Install slides tooling with Bun..."
bun install
echo "✅ Slides instalation complete!"
'''
[tasks.reinstall]
description = "Wipeout build and dependancy artifacts, then install."
category = "Install"
script = 'rm -rf node_modules/ html-slides/ html-book/ && makers i'
[tasks.reinstall-dev]
description = "Wipeout build and dependancy artifacts, then install (including dev tooling)."
category = "Install"
dependencies = ["reinstall", "install-dev"]
[tasks.install-dev]
description = "Install dev tools."
category = "Install"
dependencies = ["install-linkcheck", "install-formatter"]
[tasks.install-linkcheck]
description = "Install markup link checker (mlc)."
category = "Install"
script = "cargo install --locked mlc"
[tasks.install-formatter]
description = "Install formatter (dprint)."
category = "Install"
script = "cargo install --locked dprint"
# -----------------------------------------------------------------------------
# Serve
[tasks.s]
alias = "serve"
category = "Serve"
[tasks.sb]
alias = "serve-book"
category = "Serve"
[tasks.ss]
alias = "serve-slides"
category = "Serve"
[tasks.serve]
# FIXME - want some way to have a watching server for slides AND the book. Likely some hooks in mdBook and/or reveal-md could be used.
description = "First *build* the embedded slides, then serve book." # We must build static HTML for slides that is embedded into the book
category = "Serve"
dependencies = ["build-slides", "build-book"]
script = '''
# copy files from slides build to book build
rsync -av html-slides/content/ html-book/ --ignore-existing > /dev/null
rsync -av html-slides/ --exclude "content" html-book/ --ignore-existing > /dev/null
# The reveal tooling uses a one-too-deep path for the book
# "./../../../" in ALL CASES within the html flies should be "../../" so we fix those:
find html-book/ -regex .*\.html | xargs sed -i'' -e 's#./../../../#../../#g' > /dev/null
# serve the book with embedded slides
# FIXME non-watching server becuase mdBook clobbers the rsync we did above 😭
makers serve-embedded
'''
[tasks.serve-book]
description = "Serve book for local viewing, auto-updates for book file changes"
category = "Serve"
script = "mdbook serve -o"
[tasks.serve-slides]
description = "Serve slides only for local viewing, auto-updates for slides-source file changes"
category = "Serve"
script = "bun s"
[tasks.serve-embedded]
description = "Serve book with embedd slides for local viewing, NO updates for slides-source file changes"
category = "Serve"
script = "bun serve-book 2> /dev/null "
# -----------------------------------------------------------------------------
# Build, staging for and/or publishing for production
[tasks.b]
category = "Build"
alias = "build"
[tasks.build]
description = "Build the embedded slides, then the static site for the book."
category = "Build"
dependencies = ["build-slides", "build-book"]
[tasks.build-book]
description = "Build the static site for the book."
category = "Build"
script = "mdbook build"
[tasks.build-slides]
description = "Build the static slides only, local developmet."
category = "Build"
script = "bun build-slides-local > /dev/null"
# -----------------------------------------------------------------------------
# Dev tools for style, convention, and formatting
[tasks.c]
category = "Clean"
alias = "clean"
[tasks.clean]
description = "Clean the static build files"
category = "Clean"
dependencies = ["clean-slides", "clean-book"]
[tasks.clean-book]
description = "Clean the book static build files"
category = "Clean"
script = "rm -rf html-book"
[tasks.clean-slides]
description = "Clean the slides static build files"
category = "Clean"
script = "rm -rf html-slides"
[tasks.img]
category = "Checks"
description = "Scan for image issues througout content."
script = "./tools/scripts/orphan-image-scan.sh content/"
[tasks.l]
category = "Checks"
alias = "links"
[tasks.lf]
category = "Checks"
alias = "links-for"
[tasks.links]
category = "Checks"
description = "Check included links for all markup (.md|.html) files."
# FIXME .mlc.toml config not working... https://github.com/becheran/mlc/issues/78
script = "mlc content/ --ignore-links '*slides.md,*slides.html,*twitter.com*,*sec.gov*,*support.giphy.com*,*bitdefender.com*,*etherscan.io*,*cryptoslate.com*,*golden.com*,'"
[tasks.links-for]
category = "Checks"
description = "Check links for specific file(s). Example: `makers links-for ./content/contribute/**/*.md`"
# FIXME .mlc.toml config not working... https://github.com/becheran/mlc/issues/78
script = "mlc ${@} --ignore-links '*slides.md,*slides.html,*twitter.com*,*sec.gov*,*support.giphy.com*,*bitdefender.com*,*etherscan.io*,*cryptoslate.com*,*golden.com*,'"
[tasks.f]
category = "Format"
alias = "fmt"
[tasks.fmt]
category = "Format"
description = "Format everything."
script = "dprint fmt"
[tasks.catch-error]
description = "Check and hint at solutions to common errors."
category = "Tools"
script = '''
# Build deps are present?
if ! $(echo "type mdbook" | sh > /dev/null ); then
echo -e "❌ You may need to install the book tooling. Run:\n\nmakers install\n"
exit 127
fi
if ! $(bun --version > /dev/null) || [ ! -d node_modules ]; then
echo -e "❌ You may need to install the slides tooling. Run:\n\nmakers install-slides\n"
exit 127
fi
if ! $(echo "type mlc" | sh > /dev/null ); then
echo -e "❌ You may need to install the dev tooling. Run:\n\nmakers install-dev\n"
exit 127
fi
if ! $(echo "type dprint" | sh > /dev/null ); then
echo -e "❌ You may need to install the dev tooling. Run:\n\nmakers install-dev\n"
exit 127
fi
echo "✅ Instalation of all dependencies seems OK."
'''