Skip to content

Conversation

@inlined
Copy link
Member

@inlined inlined commented Mar 15, 2021

While reviewing docgen/generate-docs.js I had a little trouble getting my mind to think in such old JS 🙃

Updated to use async/await. In the meantime I caught a case where we weren't awaiting a promise.

@inlined inlined requested a review from joehan March 15, 2021 18:54
const files = await fs.readdir(docPath);
console.log(files);
const renames = [];
files.forEach(file => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit since it was already like this: https://google.github.io/styleguide/tsguide.html#iterating-containers suggests that we should avoid .foreach and use for loops instead.

Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few suggestion to modernize further if we want.

console.error(err);
}
}
})();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline at end of file.

const renames = [];
files.forEach(file => {
let newFileName = file;
if (_.startsWith(file, "_") && _.endsWith(file, "html")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - this is the only usage of lodash, and it can be done in native JS pretty simply.

@inlined inlined force-pushed the inlined.update-docgen branch from eaeb2c1 to b03a948 Compare March 22, 2021 21:35
@inlined
Copy link
Member Author

inlined commented Mar 22, 2021

NVM I found the bug. The old code used a global variable and I declared a local with the same name. I've removed the global.

@egilmorez
Copy link
Contributor

Glad to see you folks keeping this fresh and up to date! Assuming this doesn't change anything about how to run the script to generate output. If it does, or if it requires a node update, please LMK. Thanks!

@inlined inlined merged commit 98bf467 into master Mar 23, 2021
@inlined
Copy link
Member Author

inlined commented Mar 23, 2021

@egilmorez The script returns warnings when it's run, though I've made sure there aren't any regressions. Do you want to verify that things are working correctly?

@egilmorez
Copy link
Contributor

You bet, I'll put that on my list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants