Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Updated doc generator for typedoc 0.19.0 #1166

Merged
merged 2 commits into from
Feb 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docgen/generate-docs.js
Original file line number Diff line number Diff line change
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