|
1 | 1 | #!/usr/bin/env bash
|
2 |
| -set -e |
| 2 | +set -euo pipefail |
3 | 3 |
|
4 | 4 | echo "▶ ENABLE_TINA_ADMIN = ${ENABLE_TINA_ADMIN:-false}"
|
5 | 5 | echo "▶ DOCS_BASEURL = ${DOCS_BASEURL:-/}"
|
6 | 6 |
|
7 | 7 | #───────────────────────────────────────────────────────────────#
|
8 |
| -# 1. Build Tina -> public/admin |
| 8 | +# 1. Build Tina → static/admin (handled by publicFolder=static) |
9 | 9 | #───────────────────────────────────────────────────────────────#
|
10 | 10 | if [[ "${ENABLE_TINA_ADMIN:-}" == "true" ]]; then
|
11 | 11 | echo "📦 Building TinaCMS admin …"
|
12 | 12 | npx tinacms build
|
13 | 13 | fi
|
14 | 14 |
|
15 |
| -# Ensure sidebar index exists |
16 |
| -if [ ! -f "src/sidebars/index.json" ]; then |
| 15 | +#───────────────────────────────────────────────────────────────# |
| 16 | +# 2. Ensure an empty sidebar index exists (first-time clone) |
| 17 | +#───────────────────────────────────────────────────────────────# |
| 18 | +if [[ ! -f "src/sidebars/index.json" ]]; then |
17 | 19 | echo '{"items": []}' > src/sidebars/index.json
|
18 | 20 | fi
|
19 | 21 |
|
20 |
| -# Copy Tina admin to Docusaurus static folder |
21 |
| -rm -rf static/admin |
22 |
| -cp -r public/admin static/admin |
23 |
| - |
| 22 | +#───────────────────────────────────────────────────────────────# |
| 23 | +# 3. Inline every pre-built Reveal.js deck into static/decks/… |
| 24 | +#───────────────────────────────────────────────────────────────# |
24 | 25 | PROJECT_ROOT="$(pwd)"
|
25 | 26 | SRC_DIR="$PROJECT_ROOT/src/decks/prebuilds"
|
26 | 27 | OUT_DIR="$PROJECT_ROOT/static/decks"
|
27 | 28 |
|
28 |
| -echo "📦 Inlining Reveal.js HTML decks..." |
29 |
| - |
| 29 | +echo "📦 Inlining Reveal.js HTML decks…" |
30 | 30 | find "$SRC_DIR" -name 'index.html' | while read -r html; do
|
31 | 31 | rel_path="${html#$SRC_DIR/}"
|
32 | 32 | out_path="$OUT_DIR/$rel_path"
|
33 | 33 | out_dir="$(dirname "$out_path")"
|
34 | 34 |
|
35 | 35 | mkdir -p "$out_dir"
|
36 |
| - |
37 | 36 | echo "✨ Inlining: $rel_path"
|
38 | 37 | npx html-inline --nocompress --inlinemin --root "$PROJECT_ROOT" "$html" > "$out_path"
|
39 | 38 | done
|
40 |
| - |
41 | 39 | echo "✅ All slide decks inlined to: $OUT_DIR"
|
42 | 40 |
|
43 |
| -echo "🛠️ Building Docusaurus site..." |
44 |
| -npm run build |
| 41 | +echo "🛠️ Pre-build tasks complete; Docusaurus build will run next." |
| 42 | +# (The outer npm script runs `docusaurus build` — do **not** call it again here.) |
0 commit comments