Skip to content

Fix compat doc gen #7629

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

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
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
29 changes: 7 additions & 22 deletions scripts/docgen-compat/generate-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const yargs = require('yargs');
const fs = require('mz/fs');
const path = require('path');
const yaml = require('js-yaml');
const typescript = require('typescript');

const repoPath = path.resolve(`${__dirname}/../..`);

Expand Down Expand Up @@ -202,35 +201,21 @@ function checkForUnlistedFiles(filenamesFromToc) {
const htmlFiles = files
.filter(filename => filename.slice(-4) === 'html')
.map(filename => filename.slice(0, -5));
const removePromises = [];
htmlFiles.forEach(filename => {
if (
!filenamesFromToc.includes(filename) &&
filename !== 'index' &&
filename !== 'globals'
) {
if (shouldRemove) {
console.log(
`REMOVING ${docPath}/${filename}.html - not listed in toc.yaml.`
);
removePromises.push(fs.unlink(`${docPath}/${filename}.html`));
} else {
// This is just a warning, it doesn't need to finish before
// the process continues.
console.warn(
`Unlisted file: ${filename} generated ` +
`but not listed in toc.yaml.`
);
}
// This is just a warning, it doesn't need to finish before
// the process continues.
console.warn(
`Unlisted file: ${filename} generated ` +
`but not listed in toc.yaml.`
);
}
});
if (shouldRemove) {
return Promise.all(removePromises).then(() =>
htmlFiles.filter(filename => filenamesFromToc.includes(filename))
);
} else {
return htmlFiles;
}
return htmlFiles;
});
}

Expand Down