Skip to content

Commit 305cdfc

Browse files
committed
feat: generate index pages for api/ and api/{framework}/
After doc generation, scan the existing version directories and build index.html pages listing all available versions. This makes /api/, /api/openui5/, and /api/sapui5/ navigable instead of 404.
1 parent 2caf875 commit 305cdfc

2 files changed

Lines changed: 71 additions & 1 deletion

File tree

‎.changeset/api-index-pages.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎.github/workflows/generate-api-docs.yml‎

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
versions:
10-
description: "Specific versions to generate (comma-separated, e.g. '1.148.1,1.120.25'). Leave empty for auto-detect from maintenance versions."
10+
description: "Comma-separated versions. Use @sapui5/types@1.149.0 for SAPUI5, bare 1.149.0 defaults to OpenUI5. Leave empty for auto-detect."
1111
required: false
1212
default: ""
1313

@@ -151,6 +151,74 @@ jobs:
151151
echo "All versions up to date — nothing to generate"
152152
fi
153153
154+
- name: Update index pages
155+
working-directory: gh-pages
156+
run: |
157+
BASE="https://ui5.github.io/typescript/api"
158+
159+
# Start building api/index.html
160+
cat > api/index.html << 'EOF'
161+
<!DOCTYPE html>
162+
<html lang="en"><head>
163+
<meta charset="utf-8">
164+
<title>UI5 TypeScript API Reference</title>
165+
<meta name="description" content="Crawlable TypeScript API documentation for OpenUI5 and SAPUI5">
166+
<meta name="viewport" content="width=device-width,initial-scale=1">
167+
<link rel="canonical" href="https://ui5.github.io/typescript/api/">
168+
<style>body{font-family:system-ui,-apple-system,sans-serif;max-width:56em;margin:0 auto;padding:2em;line-height:1.6;color:#1a1a2e}a{color:#0366d6;text-decoration:none}a:hover{text-decoration:underline}h1{border-bottom:2px solid #e1e4e8;padding-bottom:0.3em}h2{margin-top:2em}table{border-collapse:collapse;width:100%}th,td{text-align:left;padding:0.5em 1em;border-bottom:1px solid #e1e4e8}th{background:#f6f8fa}nav{font-size:0.9em;margin-bottom:1.5em}</style>
169+
</head><body>
170+
<nav><a href="../">← UI5 &amp; TypeScript</a></nav>
171+
<h1>UI5 TypeScript API Reference</h1>
172+
<p>Generated from <code>@openui5/types</code> and <code>@sapui5/types</code> type definitions.</p>
173+
EOF
174+
175+
for FRAMEWORK in openui5 sapui5; do
176+
[ -d "api/${FRAMEWORK}" ] || continue
177+
TITLE=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "OpenUI5" || echo "SAPUI5" )
178+
PKG=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "@openui5/types" || echo "@sapui5/types" )
179+
180+
# Collect versions (directories containing a .version file), sorted newest first
181+
ROWS_MAIN=""
182+
ROWS_FW=""
183+
for VDIR in $(find "api/${FRAMEWORK}" -maxdepth 1 -mindepth 1 -type d | sort -t. -k2 -rn); do
184+
DIR_NAME=$(basename "$VDIR")
185+
if [ -f "${VDIR}/.version" ]; then
186+
FULL_VER=$(cat "${VDIR}/.version")
187+
ROWS_MAIN="${ROWS_MAIN}<tr><td><a href=\"${FRAMEWORK}/${DIR_NAME}/index.html\">${FULL_VER}</a></td><td>${DIR_NAME}</td></tr>"
188+
ROWS_FW="${ROWS_FW}<tr><td><a href=\"${DIR_NAME}/index.html\">${FULL_VER}</a></td><td>${DIR_NAME}</td></tr>"
189+
fi
190+
done
191+
192+
[ -z "$ROWS_MAIN" ] && continue
193+
194+
# Append framework section to main index
195+
cat >> api/index.html << EOF
196+
<h2>${TITLE}</h2>
197+
<p>Package: <code>${PKG}</code></p>
198+
<table><thead><tr><th>Version</th><th>Minor</th></tr></thead><tbody>${ROWS_MAIN}</tbody></table>
199+
EOF
200+
201+
# Create framework-specific index
202+
cat > "api/${FRAMEWORK}/index.html" << EOF
203+
<!DOCTYPE html>
204+
<html lang="en"><head>
205+
<meta charset="utf-8">
206+
<title>${TITLE} TypeScript API — Versions</title>
207+
<meta name="viewport" content="width=device-width,initial-scale=1">
208+
<link rel="canonical" href="${BASE}/${FRAMEWORK}/">
209+
<style>body{font-family:system-ui,-apple-system,sans-serif;max-width:56em;margin:0 auto;padding:2em;line-height:1.6;color:#1a1a2e}a{color:#0366d6;text-decoration:none}a:hover{text-decoration:underline}h1{border-bottom:2px solid #e1e4e8;padding-bottom:0.3em}table{border-collapse:collapse;width:100%}th,td{text-align:left;padding:0.5em 1em;border-bottom:1px solid #e1e4e8}th{background:#f6f8fa}nav{font-size:0.9em;margin-bottom:1.5em}</style>
210+
</head><body>
211+
<nav><a href="../">← All Frameworks</a></nav>
212+
<h1>${TITLE} TypeScript API</h1>
213+
<p>Package: <code>${PKG}</code></p>
214+
<table><thead><tr><th>Version</th><th>Minor</th></tr></thead><tbody>${ROWS_FW}</tbody></table>
215+
</body></html>
216+
EOF
217+
done
218+
219+
# Close main index
220+
echo "</body></html>" >> api/index.html
221+
154222
- name: Commit and push to gh-pages
155223
working-directory: gh-pages
156224
run: |

0 commit comments

Comments
 (0)