Skip to content

Commit

Permalink
chore: Updated doc generator for typedoc 0.19.0 (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiranya911 committed Feb 11, 2021
1 parent 9585775 commit 93362d5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docgen/generate-docs.js
Expand Up @@ -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 = `<section class="tsd-panel-group tsd-member-group ">
<h2>Type aliases</h2>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 93362d5

Please sign in to comment.