Skip to content

Commit 57d254e

Browse files
authored
Fix bug causing extra Node doc files to not be deleted (#1637)
Fix bug causing extra Node doc files to not be deleted
1 parent 03a4c8d commit 57d254e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/docgen/generate-docs.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ function checkForUnlistedFiles(filenamesFromToc, shouldRemove) {
182182
filename !== 'globals'
183183
) {
184184
if (shouldRemove) {
185-
console.log(`REMOVING ${filename} - not listed in toc.yaml.`);
186-
removePromises.push(() => fs.unlink(`${docPath}/${filename}`));
185+
console.log(
186+
`REMOVING ${docPath}/${filename}.html - not listed in toc.yaml.`
187+
);
188+
removePromises.push(fs.unlink(`${docPath}/${filename}.html`));
187189
} else {
188190
// This is just a warning, it doesn't need to finish before
189191
// the process continues.
@@ -195,7 +197,9 @@ function checkForUnlistedFiles(filenamesFromToc, shouldRemove) {
195197
}
196198
});
197199
if (shouldRemove) {
198-
return Promise.all(removePromises).then(() => htmlFiles);
200+
return Promise.all(removePromises).then(() =>
201+
htmlFiles.filter(filename => filenamesFromToc.includes(filename))
202+
);
199203
} else {
200204
return htmlFiles;
201205
}

0 commit comments

Comments
 (0)