From c29ced6f0f609e353d32e97bca604b288f0d24e0 Mon Sep 17 00:00:00 2001 From: akudev Date: Mon, 15 Jun 2026 21:36:54 +0200 Subject: [PATCH 1/5] feat: add SEO and LLM discoverability infrastructure - generate-index-pages.mjs: new Node.js script replacing shell heredoc HTML templating in the workflow. Generates: - api/index.html and api/{framework}/index.html (with meta description + OG tags) - sitemap.xml (sitemap index at site root) - api/llms.txt (structured overview for LLM crawlers) - generate.mjs: add Open Graph meta tags to htmlTemplate() and dates to per-version sitemap entries - workflow: replace inline shell HTML generation with script call, add sitemap.xml to git add scope --- .changeset/seo-llm-discoverability.md | 2 + .github/workflows/generate-api-docs.yml | 70 +---- .../generate-index-pages.mjs | 239 ++++++++++++++++++ scripts/generate-api-docs/generate.mjs | 14 +- 4 files changed, 257 insertions(+), 68 deletions(-) create mode 100644 .changeset/seo-llm-discoverability.md create mode 100644 scripts/generate-api-docs/generate-index-pages.mjs diff --git a/.changeset/seo-llm-discoverability.md b/.changeset/seo-llm-discoverability.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/seo-llm-discoverability.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/generate-api-docs.yml b/.github/workflows/generate-api-docs.yml index 0e2c5f97c2d..5fdacb1d09e 100644 --- a/.github/workflows/generate-api-docs.yml +++ b/.github/workflows/generate-api-docs.yml @@ -154,77 +154,17 @@ jobs: - name: Update index pages working-directory: gh-pages run: | - BASE="https://ui5.github.io/typescript/api" - - # Start building api/index.html - cat > api/index.html << 'EOF' - - - - UI5 TypeScript API Reference - - - - - - -

UI5 TypeScript API Reference

-

Generated from @openui5/types and @sapui5/types type definitions.

- EOF - - for FRAMEWORK in openui5 sapui5; do - [ -d "api/${FRAMEWORK}" ] || continue - TITLE=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "OpenUI5" || echo "SAPUI5" ) - PKG=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "@openui5/types" || echo "@sapui5/types" ) - - # Collect versions (directories containing a .version file), sorted newest first - ROWS_MAIN="" - ROWS_FW="" - for VDIR in $(find "api/${FRAMEWORK}" -maxdepth 1 -mindepth 1 -type d | sort -t. -k2 -rn); do - DIR_NAME=$(basename "$VDIR") - if [ -f "${VDIR}/.version" ]; then - FULL_VER=$(cat "${VDIR}/.version") - ROWS_MAIN="${ROWS_MAIN}${FULL_VER}${DIR_NAME}" - ROWS_FW="${ROWS_FW}${FULL_VER}${DIR_NAME}" - fi - done - - [ -z "$ROWS_MAIN" ] && continue - - # Append framework section to main index - cat >> api/index.html << EOF -

${TITLE}

-

Package: ${PKG}

- ${ROWS_MAIN}
VersionMinor
- EOF - - # Create framework-specific index - cat > "api/${FRAMEWORK}/index.html" << EOF - - - - ${TITLE} TypeScript API — Versions - - - - - -

${TITLE} TypeScript API

-

Package: ${PKG}

- ${ROWS_FW}
VersionMinor
- - EOF - done - - # Close main index - echo "" >> api/index.html + node ../main/scripts/generate-api-docs/generate-index-pages.mjs \ + --api-dir api \ + --site-root . \ + --base-url https://ui5.github.io/typescript/api - name: Commit and push to gh-pages working-directory: gh-pages run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add api/ + git add api/ sitemap.xml if git diff --cached --quiet; then echo "No changes to commit" else diff --git a/scripts/generate-api-docs/generate-index-pages.mjs b/scripts/generate-api-docs/generate-index-pages.mjs new file mode 100644 index 00000000000..a4e88862930 --- /dev/null +++ b/scripts/generate-api-docs/generate-index-pages.mjs @@ -0,0 +1,239 @@ +#!/usr/bin/env node +/** + * Generates index pages, sitemap index, and llms.txt for the API documentation site. + * + * This script runs after per-version docs have been generated. It scans the api/ + * directory for version folders (identified by a .version marker file) and produces: + * - api/index.html — main landing page listing all frameworks and versions + * - api/{framework}/index.html — per-framework version list + * - sitemap.xml — sitemap index referencing all per-version sitemaps + * - api/llms.txt — LLM-friendly structured overview + * + * Usage: + * node generate-index-pages.mjs --api-dir --site-root --base-url + * + * Example (from workflow): + * node generate-index-pages.mjs --api-dir api --site-root . --base-url https://ui5.github.io/typescript/api + */ + +import { readdirSync, readFileSync, writeFileSync, existsSync, statSync } from "fs"; +import { join, basename } from "path"; + +// --- Argument parsing --- + +const args = process.argv.slice(2); +function getArg(name) { + const idx = args.indexOf(`--${name}`); + return idx >= 0 ? args[idx + 1] : undefined; +} + +const API_DIR = getArg("api-dir"); +const SITE_ROOT = getArg("site-root"); +const BASE_URL = getArg("base-url"); + +if (!API_DIR || !SITE_ROOT || !BASE_URL) { + console.error("Usage: generate-index-pages.mjs --api-dir --site-root --base-url "); + process.exit(1); +} + +// Derive the site-level URL from the base-url (strip trailing /api or /api/) +const SITE_URL = BASE_URL.replace(/\/api\/?$/, ""); + +// --- Framework definitions --- + +const FRAMEWORKS = [ + { id: "openui5", title: "OpenUI5", pkg: "@openui5/types" }, + { id: "sapui5", title: "SAPUI5", pkg: "@sapui5/types" }, +]; + +// Key libraries to highlight in llms.txt (from OpenUI5) +const KEY_LIBRARIES = [ + { id: "sap.m", desc: "Main UI controls — Button, Input, List, Table, Dialog, MessageBox" }, + { id: "sap.ui.core", desc: "Core framework — Control, Element, Component, Model, routing" }, + { id: "sap.f", desc: "SAP Fiori controls — FlexibleColumnLayout, ShellBar, DynamicPage" }, + { id: "sap.ui.table", desc: "Analytical and tree tables" }, + { id: "sap.ui.layout", desc: "Layout controls — Grid, Splitter, ResponsiveFlowLayout" }, + { id: "sap.uxap", desc: "Object Page pattern" }, + { id: "sap.ui.integration", desc: "Integration Cards" }, + { id: "sap.tnt", desc: "Tool Page, InfoLabel, SideNavigation" }, +]; + +// --- Helpers --- + +function escapeHtml(str) { + return str.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """); +} + +/** + * Scan a framework directory for version subdirectories containing a .version marker. + * Returns sorted array (newest first) of { dir, minor, fullVersion }. + */ +function getVersions(frameworkDir) { + if (!existsSync(frameworkDir)) return []; + + return readdirSync(frameworkDir) + .filter((d) => { + const full = join(frameworkDir, d); + return statSync(full).isDirectory() && existsSync(join(full, ".version")); + }) + .map((d) => ({ + dir: d, + minor: d, + fullVersion: readFileSync(join(frameworkDir, d, ".version"), "utf8").trim(), + })) + .sort((a, b) => { + // Sort by major.minor descending (e.g. 2.1 > 1.149 > 1.136) + const [aMaj, aMin] = a.minor.split(".").map(Number); + const [bMaj, bMin] = b.minor.split(".").map(Number); + return bMaj - aMaj || bMin - aMin; + }); +} + +// --- CSS (shared with generate.mjs — index page style) --- + +const CSS = `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}`; + +function htmlPage({ title, description, canonicalUrl, nav, content }) { + return ` + + +${escapeHtml(title)} + + + + + + + + + + + +${content} + +`; +} + +function versionTable(versions, hrefPrefix) { + const rows = versions + .map((v) => `${v.fullVersion}${v.minor}`) + .join(""); + return `${rows}
VersionMinor
`; +} + +// --- Generate pages --- + +console.log("Generating index pages..."); + +// Collect all framework data +const frameworkData = FRAMEWORKS.map((fw) => ({ + ...fw, + versions: getVersions(join(API_DIR, fw.id)), +})).filter((fw) => fw.versions.length > 0); + +// 1. Main index: api/index.html +const mainSections = frameworkData + .map( + (fw) => `

${fw.title}

+

Package: ${fw.pkg}

+${versionTable(fw.versions, `${fw.id}/`)}` + ) + .join("\n"); + +writeFileSync( + join(API_DIR, "index.html"), + htmlPage({ + title: "UI5 TypeScript API Reference", + description: "Crawlable TypeScript API documentation for OpenUI5 and SAPUI5", + canonicalUrl: `${BASE_URL}/`, + nav: `← UI5 & TypeScript`, + content: `

UI5 TypeScript API Reference

+

Generated from @openui5/types and @sapui5/types type definitions.

+${mainSections}`, + }) +); +console.log(" api/index.html"); + +// 2. Per-framework index: api/{framework}/index.html +for (const fw of frameworkData) { + writeFileSync( + join(API_DIR, fw.id, "index.html"), + htmlPage({ + title: `${fw.title} TypeScript API — Versions`, + description: `${fw.title} TypeScript API — available versions of ${fw.pkg} type definitions`, + canonicalUrl: `${BASE_URL}/${fw.id}/`, + nav: `← All Frameworks`, + content: `

${fw.title} TypeScript API

+

Package: ${fw.pkg}

+${versionTable(fw.versions, "")}`, + }) + ); + console.log(` api/${fw.id}/index.html`); +} + +// 3. Sitemap index: sitemap.xml (at site root) +const sitemapRefs = []; + +// Include the static site sitemap if it exists +const siteSitemapPath = join(SITE_ROOT, "sitemap-site.xml"); +if (existsSync(siteSitemapPath)) { + sitemapRefs.push(`${SITE_URL}/sitemap-site.xml`); +} + +// Include all per-version sitemaps +for (const fw of frameworkData) { + for (const v of fw.versions) { + const sitemapPath = join(API_DIR, fw.id, v.dir, "sitemap.xml"); + if (existsSync(sitemapPath)) { + sitemapRefs.push(`${BASE_URL}/${fw.id}/${v.dir}/sitemap.xml`); + } + } +} + +const sitemapIndex = ` + +${sitemapRefs.map((url) => ` ${url}`).join("\n")} + +`; + +writeFileSync(join(SITE_ROOT, "sitemap.xml"), sitemapIndex); +console.log(` sitemap.xml (${sitemapRefs.length} sitemaps)`); + +// 4. LLM-friendly overview: api/llms.txt +const latestOpenUI5 = frameworkData.find((fw) => fw.id === "openui5")?.versions[0]; + +let llmsTxt = `# UI5 TypeScript API Reference + +> Complete TypeScript API documentation for the OpenUI5 and SAPUI5 UI frameworks, generated from @openui5/types and @sapui5/types npm packages. + +Each class page includes the TypeScript import statement, inheritance hierarchy, constructor signatures, properties, methods, events, and associations. All content is static HTML — no JavaScript required for reading. + +## Versions +`; + +for (const fw of frameworkData) { + llmsTxt += `\n### ${fw.title}\n`; + for (const v of fw.versions) { + llmsTxt += `- [${fw.title} ${v.minor}](${BASE_URL}/${fw.id}/${v.dir}/index.html): ${v.fullVersion}\n`; + } +} + +if (latestOpenUI5) { + const latestDir = latestOpenUI5.dir; + llmsTxt += `\n## Key Libraries (OpenUI5 ${latestDir})\n\n`; + for (const lib of KEY_LIBRARIES) { + llmsTxt += `- [${lib.id}](${BASE_URL}/openui5/${latestDir}/${lib.id}/README.html): ${lib.desc}\n`; + } +} + +llmsTxt += `\n## Resources\n +- [Sitemap Index](${SITE_URL}/sitemap.xml): Machine-readable index of all per-version sitemaps +- [UI5 & TypeScript Guide](${SITE_URL}/): Getting started, FAQ, release notes +- [npm: @openui5/types](https://www.npmjs.com/package/@openui5/types): OpenUI5 type definitions package +- [npm: @sapui5/types](https://www.npmjs.com/package/@sapui5/types): SAPUI5 type definitions package +`; + +writeFileSync(join(API_DIR, "llms.txt"), llmsTxt); +console.log(" api/llms.txt"); + +console.log("\nDone."); diff --git a/scripts/generate-api-docs/generate.mjs b/scripts/generate-api-docs/generate.mjs index 53d4b9d1ab5..5cb9c7a2f63 100644 --- a/scripts/generate-api-docs/generate.mjs +++ b/scripts/generate-api-docs/generate.mjs @@ -330,14 +330,21 @@ footer{margin-top:3em;padding-top:1em;border-top:1px solid #e1e4e8;font-size:0.8 .kw{color:#d73a49}.tp{color:#6f42c1}.fn{color:#6f42c1}.str{color:#032f62}.cm{color:#6a737d}`; function htmlTemplate(title, breadcrumb, content, canonicalUrl) { + const fullTitle = escapeHtml(`${title} — ${frameworkName} TypeScript API`); + const description = escapeHtml(`${title} — ${frameworkName} TypeScript API Reference (${actualVersion})`); return ` -${escapeHtml(title)} — ${frameworkName} TypeScript API - +${fullTitle} + ${canonicalUrl ? `` : ""} + + + +${canonicalUrl ? `` : ""} + @@ -459,6 +466,7 @@ console.log(` Rendered ${fileCount} HTML files (skipped ${skippedCount} jQuery- // --- Step 5: Generate sitemap --- console.log("\nStep 5: Generating sitemap..."); const sitemapEntries = []; +const today = new Date().toISOString().slice(0, 10); function collectUrls(dir) { for (const entry of readdirSync(dir)) { @@ -477,7 +485,7 @@ collectUrls(OUT_DIR); const sitemap = ` -${sitemapEntries.map((url) => ` ${url}`).join("\n")} +${sitemapEntries.map((url) => ` ${url}${today}`).join("\n")} `; writeFileSync(join(OUT_DIR, "sitemap.xml"), sitemap); From 5b9e9bc02ea48a5dfec0d391462d3644d61b89bd Mon Sep 17 00:00:00 2001 From: akudev Date: Mon, 15 Jun 2026 23:03:31 +0200 Subject: [PATCH 2/5] fix: exclude cross-library re-exports from API docs output TypeDoc merges all .d.ts files into one documentation set, causing the shared 'sap' namespace to duplicate content across library directories. For example, sap.f/namespaces/sap/namespaces/m/ contained sap.m classes, and sap.f/sap/tnt/ contained sap.tnt enums (from a module augmentation). The fix collects which modules each .d.ts file declares, then excludes pages that either: - Don't match any declared module (namespace re-export artefacts) - Match a module whose namespace belongs to another library (augmentation) This removes ~54 duplicate pages per library that had cross-library content, reducing confusion and improving the signal-to-noise ratio for crawlers. --- .../generate-index-pages.mjs | 6 ++- scripts/generate-api-docs/generate.mjs | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/scripts/generate-api-docs/generate-index-pages.mjs b/scripts/generate-api-docs/generate-index-pages.mjs index a4e88862930..49a5d46b0d2 100644 --- a/scripts/generate-api-docs/generate-index-pages.mjs +++ b/scripts/generate-api-docs/generate-index-pages.mjs @@ -17,7 +17,7 @@ */ import { readdirSync, readFileSync, writeFileSync, existsSync, statSync } from "fs"; -import { join, basename } from "path"; +import { join } from "path"; // --- Argument parsing --- @@ -226,7 +226,9 @@ if (latestOpenUI5) { } } -llmsTxt += `\n## Resources\n +llmsTxt += ` +## Resources + - [Sitemap Index](${SITE_URL}/sitemap.xml): Machine-readable index of all per-version sitemaps - [UI5 & TypeScript Guide](${SITE_URL}/): Getting started, FAQ, release notes - [npm: @openui5/types](https://www.npmjs.com/package/@openui5/types): OpenUI5 type definitions package diff --git a/scripts/generate-api-docs/generate.mjs b/scripts/generate-api-docs/generate.mjs index 5cb9c7a2f63..95a8f4bdbb1 100644 --- a/scripts/generate-api-docs/generate.mjs +++ b/scripts/generate-api-docs/generate.mjs @@ -103,15 +103,26 @@ let totalReplacements = 0; // Maps module path → default export name, e.g. "sap/m/Button" → "Button", "sap/ui/core/Element" → "UI5Element" const defaultExports = new Map(); +// Also collect which module paths are declared in each library file. +// This is used later to exclude cross-library re-exports from the output. +// Maps library name (e.g. "sap.f") → Set of module paths declared in that .d.ts +const libraryModules = new Map(); + for (const file of dtsFiles) { const filePath = join(TYPES_DIR, file); const content = readFileSync(filePath, "utf8"); + // Track which modules are declared in this library file (e.g. "sap.f.d.ts" → "sap.f") + const libName = file.replace(/\.d\.ts$/, ""); // e.g. "sap.f" + if (!libraryModules.has(libName)) libraryModules.set(libName, new Set()); + const libModules = libraryModules.get(libName); + // Find: declare module "sap/m/Button" { ... export default class Button const moduleRegex = /^declare module "([^"]+)"/gm; let moduleMatch; while ((moduleMatch = moduleRegex.exec(content)) !== null) { const moduleName = moduleMatch[1]; + libModules.add(moduleName); const moduleStart = moduleMatch.index; // Find the next declare module to bound our search const nextModule = content.indexOf("\ndeclare module ", moduleStart + 1); @@ -365,11 +376,54 @@ let skippedCount = 0; // Directories/files to exclude from output (not UI5-specific) const EXCLUDE_PATTERNS = ["interfaces/JQuery", "interfaces/JQuery.", "/JQueryStatic", "JQueryPromise"]; +// Precompute namespace prefixes for all libraries (used to detect augmentations) +// e.g. "sap.f" → "sap/f/", "sap.ui.core" → "sap/ui/core/" +const libNamespacePrefixes = new Map(); +for (const lib of libraryModules.keys()) { + libNamespacePrefixes.set(lib, lib.replace(/\./g, "/") + "/"); +} + function shouldExclude(relPath) { // Exclude jQuery-related pages if (EXCLUDE_PATTERNS.some((p) => relPath.includes(p))) return true; // Exclude residual "default.html" pages (from un-renamed default exports) if (relPath.endsWith("/default.html")) return true; + // Exclude cross-library re-exports. + // TypeDoc merges all .d.ts files into one documentation set, so the shared "sap" namespace + // causes content from other libraries to appear under each library's directory. + // We exclude a page if: + // (a) it doesn't match any module declared in the library's own .d.ts, OR + // (b) the module it matches belongs to another library's namespace (an augmentation). + // For example, sap.f.d.ts augments "sap/tnt/library" — but sap.tnt owns that namespace, + // so we exclude it from sap.f's output. Meanwhile sap.ui.core.d.ts declares "sap/base/Log" + // which no other library owns, so it stays. + const libMatch = relPath.match(/^(sap\.[^/]+)\//); + if (libMatch) { + const lib = libMatch[1]; // e.g. "sap.f" + const afterLib = relPath.slice(lib.length + 1); // path after "sap.f/" + // Always keep the library's own README (the module index page) + if (afterLib === "README.html") return false; + // Check against the definitive module list for this library + const modules = libraryModules.get(lib); + if (modules && modules.size > 0) { + // Find the declared module that matches this page's path (iterate Set directly) + let matchingModule; + for (const mod of modules) { + if (afterLib.startsWith(mod + "/")) { + matchingModule = mod; + break; + } + } + if (!matchingModule) return true; // no matching module → re-export/namespace artefact + // Check if another library owns this module's namespace (= augmentation) + const moduleNs = matchingModule + "/"; // e.g. "sap/tnt/library/" + for (const [otherLib, otherNs] of libNamespacePrefixes) { + if (otherLib !== lib && moduleNs.startsWith(otherNs)) { + return true; + } + } + } + } return false; } From 44a33adf32c750f00778620df49b711a2e2c005f Mon Sep 17 00:00:00 2001 From: akudev Date: Tue, 16 Jun 2026 13:32:37 +0200 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20address=20review=20feedback=20?= =?UTF-8?q?=E2=80=94=20normalize=20base-url,=20use=20O(1)=20module=20looku?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - generate-index-pages.mjs: strip trailing slashes from --base-url to prevent double-slash URLs in canonical links and sitemaps - generate.mjs: replace O(N) module scan in shouldExclude() with O(1) Set.has() lookups by deriving the module path from directory prefixes --- .../generate-api-docs/generate-index-pages.mjs | 2 +- scripts/generate-api-docs/generate.mjs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/generate-api-docs/generate-index-pages.mjs b/scripts/generate-api-docs/generate-index-pages.mjs index 49a5d46b0d2..4d442d53806 100644 --- a/scripts/generate-api-docs/generate-index-pages.mjs +++ b/scripts/generate-api-docs/generate-index-pages.mjs @@ -29,7 +29,7 @@ function getArg(name) { const API_DIR = getArg("api-dir"); const SITE_ROOT = getArg("site-root"); -const BASE_URL = getArg("base-url"); +const BASE_URL = (getArg("base-url") || "").replace(/\/+$/, ""); // strip trailing slashes if (!API_DIR || !SITE_ROOT || !BASE_URL) { console.error("Usage: generate-index-pages.mjs --api-dir --site-root --base-url "); diff --git a/scripts/generate-api-docs/generate.mjs b/scripts/generate-api-docs/generate.mjs index 95a8f4bdbb1..c5c44676bce 100644 --- a/scripts/generate-api-docs/generate.mjs +++ b/scripts/generate-api-docs/generate.mjs @@ -406,13 +406,20 @@ function shouldExclude(relPath) { // Check against the definitive module list for this library const modules = libraryModules.get(lib); if (modules && modules.size > 0) { - // Find the declared module that matches this page's path (iterate Set directly) + // Derive the module path from afterLib by trying successive directory prefixes. + // E.g. "sap/f/Avatar/classes/Avatar.html" → try "sap/f/Avatar/classes/Avatar", + // "sap/f/Avatar/classes", "sap/f/Avatar" until a Set.has() hit (O(1) per check). let matchingModule; - for (const mod of modules) { - if (afterLib.startsWith(mod + "/")) { - matchingModule = mod; + const stripped = afterLib.replace(/\.html$/, ""); + let candidate = stripped; + while (candidate) { + if (modules.has(candidate)) { + matchingModule = candidate; break; } + const lastSlash = candidate.lastIndexOf("/"); + if (lastSlash < 0) break; + candidate = candidate.slice(0, lastSlash); } if (!matchingModule) return true; // no matching module → re-export/namespace artefact // Check if another library owns this module's namespace (= augmentation) From bc704bb70f9957dc92ceca9bb4a9de0af68978aa Mon Sep 17 00:00:00 2001 From: akudev Date: Tue, 16 Jun 2026 13:36:07 +0200 Subject: [PATCH 4/5] fix: parse npm show output correctly for multi-version ranges npm show with a version range (e.g. ~1.136.0) outputs lines like '@openui5/types@1.136.17 '1.136.17'' instead of just '1.136.17'. Extract the bare semver with grep to avoid malformed version strings that fail the downstream validation. --- .github/workflows/generate-api-docs.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-api-docs.yml b/.github/workflows/generate-api-docs.yml index 5fdacb1d09e..6ab6dc5e5b1 100644 --- a/.github/workflows/generate-api-docs.yml +++ b/.github/workflows/generate-api-docs.yml @@ -75,8 +75,9 @@ jobs: PKG=$( [[ "$OVERVIEW_URL" == *"openui5"* ]] && echo "@openui5/types" || echo "@sapui5/types" ) for LINE in $MAINT_LINES; do - # Get the latest published patch for this minor line - LATEST=$(npm show "${PKG}@~${LINE}.0" version 2>/dev/null | tail -1) + # Get the latest published patch for this minor line. + # npm show with a range outputs "pkg@ver 'ver'" per match; extract the bare version. + LATEST=$(npm show "${PKG}@~${LINE}.0" version 2>/dev/null | tail -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | tail -1) if [ -n "$LATEST" ]; then VERSIONS="${VERSIONS}${VERSIONS:+,}${PKG}@${LATEST}" fi From 8e304f8b1f2be69f3395ede599fc8c71f58436f8 Mon Sep 17 00:00:00 2001 From: akudev Date: Tue, 16 Jun 2026 16:56:39 +0200 Subject: [PATCH 5/5] fix: support UI5 2.x in version filter, clarify exclusion comment - Workflow: version floor now uses major >= 2 || (major === 1 && minor >= 120) instead of just minor >= 120, which would exclude future 2.x versions. - generate.mjs: clarify the shouldExclude comment per review feedback. --- .github/workflows/generate-api-docs.yml | 7 +++++-- scripts/generate-api-docs/generate.mjs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-api-docs.yml b/.github/workflows/generate-api-docs.yml index 6ab6dc5e5b1..1a0057e1e79 100644 --- a/.github/workflows/generate-api-docs.yml +++ b/.github/workflows/generate-api-docs.yml @@ -60,7 +60,7 @@ jobs: for OVERVIEW_URL in "https://sdk.openui5.org/versionoverview.json" "https://ui5.sap.com/versionoverview.json"; do # Get LTS versions + the latest (highest) maintenance version - # Filter: lts===true OR highest minor. Hard floor: minor >= 120. + # Filter: lts===true OR highest minor. Floor: types packages exist since 1.120. MAINT_LINES=$(curl -sf "$OVERVIEW_URL" | node -e " const data = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')); const maintained = data.versions.filter(v => v.support === 'Maintenance'); @@ -68,7 +68,10 @@ jobs: const lines = maintained .filter(v => v.lts === true || v === latest) .map(v => v.version.replace('.*','')) - .filter(v => parseInt(v.split('.')[1]) >= 120); + .filter(v => { + const [maj, min] = v.split('.').map(Number); + return maj >= 2 || (maj === 1 && min >= 120); + }); console.log(lines.join(' ')); ") diff --git a/scripts/generate-api-docs/generate.mjs b/scripts/generate-api-docs/generate.mjs index c5c44676bce..505f453ad66 100644 --- a/scripts/generate-api-docs/generate.mjs +++ b/scripts/generate-api-docs/generate.mjs @@ -421,7 +421,7 @@ function shouldExclude(relPath) { if (lastSlash < 0) break; candidate = candidate.slice(0, lastSlash); } - if (!matchingModule) return true; // no matching module → re-export/namespace artefact + if (!matchingModule) return true; // not declared in this library's .d.ts — exclude // Check if another library owns this module's namespace (= augmentation) const moduleNs = matchingModule + "/"; // e.g. "sap/tnt/library/" for (const [otherLib, otherNs] of libNamespacePrefixes) {