From f9ec631b45d9b2fa7390c24aec0b7ec95f30a31d Mon Sep 17 00:00:00 2001 From: Hiranya Jayathilaka Date: Wed, 10 Feb 2021 13:23:47 -0800 Subject: [PATCH] chore: Updated doc generator for typedoc 0.19.0 --- docgen/generate-docs.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docgen/generate-docs.js b/docgen/generate-docs.js index 4f8b8df736..12f93706b7 100644 --- a/docgen/generate-docs.js +++ b/docgen/generate-docs.js @@ -46,7 +46,11 @@ const contentPath = path.resolve(`${__dirname}/content-sources/node`); const tempHomePath = path.resolve(`${contentPath}/HOME_TEMP.md`); const devsitePath = `/docs/reference/admin/node/`; -const firestoreExcludes = ['v1', 'v1beta1', 'setLogFunction','DocumentData']; +const firestoreExcludes = [ + 'v1', 'v1beta1', 'setLogFunction','DocumentData', + 'BulkWriterOptions', 'DocumentChangeType', 'FirestoreDataConverter', + 'GrpcStatus', 'Precondition', 'ReadOptions', 'UpdateData', 'Settings', +]; const firestoreHtmlPath = `${docPath}/admin.firestore.html`; const firestoreHeader = `

Type aliases

@@ -278,6 +282,18 @@ function updateHtml(htmlPath, contentBlock) { const dom = new jsdom.JSDOM(fs.readFileSync(htmlPath)); const contentNode = dom.window.document.body.querySelector('.col-12'); + // Recent versions of Typedoc generates an additional index section and a variables + // section for namespaces with re-exports. We iterate through these nodes and remove + // them from the output. + const sections = []; + contentNode.childNodes.forEach((child) => { + if (child.nodeName === 'SECTION') { + sections.push(child); + } + }); + contentNode.removeChild(sections[1]); + contentNode.removeChild(sections[2]); + const newSection = new jsdom.JSDOM(contentBlock); contentNode.appendChild(newSection.window.document.body.firstChild); fs.writeFileSync(htmlPath, dom.window.document.documentElement.outerHTML);