-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
273 lines (249 loc) · 7.53 KB
/
Copy pathTaskfile.yml
File metadata and controls
273 lines (249 loc) · 7.53 KB
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
version: '3'
tasks:
setup:
desc: Install all build dependencies
cmds:
- task: setup:inklecate
- task: setup:watch
- task: setup:npm
- task: setup:jekyll
setup:inklecate:
desc: Install inklecate compiler
silent: true
cmds:
- |
if [ -f "./bin/inklecate" ]; then
echo "✅ inklecate already installed"
exit 0
fi
echo "📦 Installing inklecate..."
mkdir -p bin
cd bin
wget -q https://github.com/inkle/ink/releases/latest/download/inklecate_linux.zip
unzip -q inklecate_linux.zip
rm -rf inklecate_linux.zip
chmod +x inklecate
echo "✅ inklecate installed"
setup:watch:
desc: Install inotify-tools for file watching
silent: true
cmds:
- |
if command -v inotifywait >/dev/null 2>&1; then
echo "✅ inotify-tools already installed"
exit 0
fi
echo "📦 Installing inotify-tools..."
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y inotify-tools
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y inotify-tools
else
echo "❌ Unknown package manager. Install inotify-tools manually."
exit 1
fi
echo "✅ inotify-tools installed"
setup:npm:
desc: Install npm dependencies for testing
silent: true
cmds:
- |
if ! command -v node >/dev/null 2>&1; then
echo "❌ Node.js not found. Install from https://nodejs.org/"
exit 1
fi
if [ ! -d "node_modules" ] || [ "package.json" -nt "node_modules" ]; then
echo "📦 Installing npm dependencies..."
npm install
echo "✅ npm dependencies installed"
else
echo "✅ npm dependencies already installed"
fi
setup:jekyll:
desc: Install Jekyll dependencies for docs site
silent: true
dir: docs
cmds:
- |
if ! command -v bundle >/dev/null 2>&1; then
echo "❌ Bundler not found. Install Ruby and run: gem install bundler jekyll"
exit 1
fi
if [ ! -d "vendor/bundle" ] || [ "Gemfile" -nt "Gemfile.lock" ]; then
echo "📦 Installing Jekyll dependencies..."
bundle config set --local path 'vendor/bundle'
bundle install
echo "✅ Jekyll dependencies installed"
else
echo "✅ Jekyll dependencies already installed"
fi
build:
desc: Build everything for production
cmds:
- task: clean
- task: build:js
- task: build:css
- task: build:html
- task: compile
- echo "✅ Production build complete."
compile:
desc: Compile Ink story to JSON
silent: true
cmds:
- |
echo "---- Compiling Ink story to JSON"
echo "./bin/inklecate -o build/story.json -j src/ink/main.ink"
if ./bin/inklecate -o build/story.json -j src/ink/main.ink; then
echo "✅ Compilation complete! Refresh your browser."
else
echo ""
echo "❌ Compilation failed. Fix errors and save to retry."
fi
build:js:
desc: Bundle and minify JS
silent: true
deps: [setup:npm]
cmds:
- |
echo "---- Bundling and minifying JavaScript..."
mkdir -p build/js
VERSION="${TEMPLATE_VERSION:-dev}"
npx esbuild src/js/main.js --bundle --minify --sourcemap \
--define:__TEMPLATE_VERSION__="\"$VERSION\"" \
--outfile=build/js/template.min.js
echo "✅ build/js/template.min.js created"
build:css:
desc: Bundle and minify CSS
silent: true
deps: [setup:npm]
cmds:
- |
echo "---- Bundling and minifying CSS..."
mkdir -p build/css
npx esbuild src/css/main.css --bundle --minify --outfile=build/css/template.min.css --external:*.woff2 --external:*.woff
echo "✅ build/css/template.min.css created"
build:html:
desc: Copy HTML to build
silent: true
cmds:
- |
echo "---- Copying HTML..."
cp src/index.html build/index.html
echo "✅ build/index.html copied"
dev:
desc: Start development environment (watch + serve)
deps: [watch, serve]
test:
desc: Run all tests (unit & E2E)
silent: true
deps: [setup:npm]
cmds:
- task test:unit
- task test:e2e
test:unit:
desc: Run unit tests
silent: true
deps: [setup:npm]
cmds:
- npm test {{.CLI_ARGS}}
test:unit:verbose:
desc: Run unit tests
silent: true
deps: [setup:npm]
cmds:
- npm run test:verbose
test:e2e:
desc: Run E2E tests
silent: true
deps: [setup:npm]
cmds:
- npx playwright test {{.CLI_ARGS}}
lint:
desc: Run linter
silent: true
deps: [setup:npm]
cmds:
- npm run lint
serve:
desc: Start web server for development
silent: true
cmds:
- |
echo "---- Starting web server for development."
echo "http://localhost:8000"
echo "Press Ctrl+C to stop"
# cd build && python3 -m http.server 8000
cd build && python3 -m http.server 8000 --bind 0.0.0.0
interactive: true
watch:
desc: Watch for changes and auto-rebuild
silent: true
cmds:
- |
echo "---- Watching src/ for changes..."
task build
if command -v inotifywait >/dev/null 2>&1; then
while inotifywait -e modify,create,delete -r src/ --exclude='.*\.swp$' 2>/dev/null; do
echo "🔄 Changes detected, rebuilding..."
task build
done
else
echo "❌ inotify-tools not found. Run 'task setup:watch' to install."
fi
interactive: true
docs:
desc: Serve documentation site locally
silent: true
dir: docs
deps: [setup:jekyll]
cmds:
- |
echo "---- Building docs..."
bundle exec jekyll build --config _config.yml,_config_dev.yml
echo ""
echo "---- Serving at http://localhost:4000/"
echo "---- Watching for changes. Press Ctrl+C to stop."
echo ""
cd _site && python3 -m http.server 4000 &
SERVER_PID=$!
trap "kill $SERVER_PID 2>/dev/null" EXIT
while inotifywait -q -e modify,create,delete -r . --exclude='(_site|vendor|\.conform|\.\#|\.swp)' 2>/dev/null; do
echo "🔄 Rebuilding..."
bundle exec jekyll build --config _config.yml,_config_dev.yml
echo "✅ Done. Refresh browser with Ctrl+R or Ctrl+Shift+R"
done
interactive: true
docs:images:exif:
desc: Strip all metadata from documentation images
silent: true
cmds:
- |
echo "---- Stripping EXIF data from docs/assets/images/ ..."
exiftool -all= -overwrite_original -r docs/assets/images/
echo "---- Stripping EXIF data from screenshots/ ..."
exiftool -all= -overwrite_original -r screenshots/
echo "✅ Done"
docs:images:sizes:
desc: Print sizes of all documentation images
silent: true
cmds:
- |
for f in docs/assets/images/*/*.png; do echo "$f: $(identify -format '%wx%h' "$f")"; done
clean:
desc: Clean generated build files (preserves author files)
silent: true
cmds:
- |
echo "---- Cleaning generated build files..."
rm -f build/story.json
rm -f build/js/template.min.js
rm -f build/css/template.min.css
rm -f build/index.html
echo "Done"
help:
desc: Show available tasks
cmds:
- task --list
default:
cmds:
- task: help