-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(progress-bar): setup basic #98
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: flakey5 <[email protected]>
Co-authored-by: flakey5 <[email protected]>
Co-authored-by: flakey5 <[email protected]>
@AugustinMauroy, any progress here? Would love to have this landed! |
I'll take time today to fix this pr. When a generator as ended the process still running because the progressbar did't ended correctly |
@ovflowd could you give last review ? 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the progress bar should be for:
- Loader (progress of loading files)
- Parser (progress of parsing files)
- Top Level generator.mjs (progress of going through generators, instead of each file being generated)
@@ -26,8 +28,17 @@ const createLoader = () => { | |||
filePath => extname(filePath) === '.md' | |||
); | |||
|
|||
const progressBar = createProgressBar('Loading files'); | |||
progressBar.start(resolvedFiles.length, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add white spaces between statements and if conditions?
progressBar.increment(); | ||
// normally we stop the progress bar when the loop is done | ||
// but here we return the loop so we need to stop it when the last file is loaded | ||
if (progressBar.value === progressBar.total) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the .stop() call needed? what happens if we simply stop incrementing when value === total?
const resolvedApiDocEntries = await Promise.all( | ||
apiDocs.map(async apiDoc => { | ||
progressBar.increment(); | ||
return await parseApiDoc(apiDoc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need of adding return await
the function itself is already async, so you can drop the async apiDoc
and simply do return parseApiDoc
Since the map function doesn't do any async work itself.
@@ -12,14 +14,20 @@ export const groupNodesByModule = nodes => { | |||
/** @type {Map<string, Array<ApiDocMetadataEntry>>} */ | |||
const groupedNodes = new Map(); | |||
|
|||
const progressBar = createProgressBar(groupNodesByModule.name); | |||
progressBar.start(nodes.length, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be inside this util :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify the only thing this util should do is to group nodes by module; This is breaking the single responsibility pattern.
Description
Adding a cool progress bar to know what is going on.
Validation
Run this command and see progress bar
npx api-docs-tooling -i "/path/to/node/doc/api/*.md" -t legacy-html -o /tmp/out
Related Issues
Close #58
Check List