From f48bf3a4557f0d79d28b20d5178873cede129c1c Mon Sep 17 00:00:00 2001 From: alejoamiras Date: Thu, 26 Nov 2026 16:56:28 +0000 Subject: [PATCH 1/4] fix(docs): give each TypeScript API reference folder an index page The build now writes typescript-api//index.html, listing the folder's package files, its llms.txt and llm-summary.txt, and the guide, so the folder's URL and its mainnet and testnet aliases stop answering 404. check_built_site fails a build where a served folder lacks it. --- .../__tests__/check_built_site.test.mts | 2 + .../__tests__/split_typescript_api.test.mts | 37 ++++++++++++++- docs/scripts/check_built_site.mts | 5 +++ docs/scripts/split_typescript_api.mjs | 45 ++++++++++++++++--- 4 files changed, 82 insertions(+), 7 deletions(-) diff --git a/docs/scripts/__tests__/check_built_site.test.mts b/docs/scripts/__tests__/check_built_site.test.mts index 3e24a2bebce..a02739be502 100644 --- a/docs/scripts/__tests__/check_built_site.test.mts +++ b/docs/scripts/__tests__/check_built_site.test.mts @@ -136,6 +136,7 @@ function fixtureBuild(): { dir: string; write: (url: string, html: string) => vo write(`/operate/v5.2.0/${opPage}`, shell("") + config); for (const v of ["", "v5.2.0/"]) write(`/operate/${v}operators/solo-sequencer/install-toolchain`, shell("") + "v6.0.0"); for (const page of MATH_PAGES) write(`/developers/${page}`, shell("") + math); + write("/typescript-api/v6.0.0/index", ""); return { dir, write }; } const math = "

rollup

"; @@ -191,6 +192,7 @@ test("main passes a healthy build and names each regression it is for", () => { (b) => fs.rmSync(path.join(b.dir, `developers/${MATH_PAGES[1]}.html`)), /MATH_PAGES docs\/foundational-topics\/ethereum-aztec-messaging: no built page renders math there/, ], + ["TypeScript folder page gone", (b) => fs.rmSync(path.join(b.dir, "typescript-api/v6.0.0/index.html")), /\/typescript-api\/v6\.0\.0\/: no index\.html/], ]; for (const [name, breakIt, expected] of breaks) { const b = fixtureBuild(); diff --git a/docs/scripts/__tests__/split_typescript_api.test.mts b/docs/scripts/__tests__/split_typescript_api.test.mts index 3faa4629f2a..9b8548f72f7 100644 --- a/docs/scripts/__tests__/split_typescript_api.test.mts +++ b/docs/scripts/__tests__/split_typescript_api.test.mts @@ -1,9 +1,11 @@ import assert from "node:assert/strict"; import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; import { test } from "node:test"; import networkDocs from "../../src/network_docs.js"; import packages from "../typescript_api_generation/packages.js"; -import { declarations, splitPackage } from "../split_typescript_api.mjs"; +import { declarations, folderPage, main, splitPackage } from "../split_typescript_api.mjs"; const pkg = [ "# @aztec/foundation", @@ -77,6 +79,39 @@ test("every declaration of the committed reference lands in exactly one page", ( } }); +test("each served folder gets an index page listing the package files it holds, its indexes and the guide", (t) => { + t.mock.method(console, "log", () => {}); + const config = JSON.parse(fs.readFileSync(new URL("../../developer_version_config.json", import.meta.url), "utf8")); + const folder = networkDocs.networkApiFolder(config, "mainnet"); + const build = fs.mkdtempSync(path.join(os.tmpdir(), "ts-folder-page-")); + try { + const dir = path.join(build, "typescript-api", folder); + fs.mkdirSync(dir, { recursive: true }); + for (const file of ["aztec.js.md", "foundation.md", "llm-summary.txt"]) fs.writeFileSync(path.join(dir, file), pkg); + assert.equal(main(build, {}), 0); + const html = fs.readFileSync(path.join(dir, "index.html"), "utf8"); + const hrefs = [...html.matchAll(/href="([^"]+)"/g)].map((m) => m[1]); + assert.deepEqual(hrefs, [ + `/typescript-api/${folder}/llms.txt`, + "/developers/docs/aztec-js/typescript_api_reference", + `/typescript-api/${folder}/aztec.js.md`, + `/typescript-api/${folder}/foundation.md`, + `/typescript-api/${folder}/llm-summary.txt`, + ]); + assert.match(html, new RegExp(`^\\n[\\s\\S]*TypeScript API reference, ${folder}`)); + assert.match(html, //); + assert.match(html, />@aztec-labs\/aztec\.js<\/a>: Main SDK for building Aztec applications { + const html = folderPage({ dir: "typescript-api/v1.0.0", version: "v1.0.0", packages: [{ file: "a.md", npmName: "@x/a", description: '