feat(badges): Display npm version and downloads badges by default#20
feat(badges): Display npm version and downloads badges by default#20ioncakephper merged 1 commit intomainfrom
Conversation
The `README.md` has been updated to include `npm version` and `npm downloads` badges in the main section by default. This was achieved by removing them from the `excludeBadges` option in the `doc-gen` configuration. To maintain a concise initial view, the `stars` and `forks` badges have been moved into the collapsed 'More badges' section. Additionally, a debugging `console.log` statement for `excludeBadges` was removed from `index.js`, and a trailing space was added to the badge output in `index.js` when badges are not collapsed, ensuring better markdown formatting.
Summary of ChangesHello @ioncakephper, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the presentation of project badges in the README by making critical 'npm version' and 'npm downloads' badges immediately visible. To balance information density, 'stars' and 'forks' badges have been moved into a collapsible section. Additionally, the change includes minor code improvements such as removing a debugging statement and adjusting markdown output for better formatting. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the default badge display to include npm version and download counts, moving the stars and forks badges to a collapsed section to maintain a clean README. It also removes a debugging console.log and adds a trailing space for better markdown formatting of badges. My review identifies a minor edge case with the new formatting logic and provides a suggestion to make it more robust.
| // If collapse not requested or nothing hidden, return all inline, with a trailing space | ||
| if (!collapse || hidden.length === 0) { | ||
| return allBadges.map((b) => b.md).join(" "); | ||
| return allBadges.map((b) => b.md).join(" ") + " "; |
There was a problem hiding this comment.
While adding a trailing space for better markdown formatting is a good idea, the current implementation has a small side effect. If allBadges is empty (for example, if a user excludes all badges), this line will return a single space " " instead of an empty string. This can result in unnecessary whitespace in the output.
A check to ensure badges exist before adding the trailing space would make this more robust.
| return allBadges.map((b) => b.md).join(" ") + " "; | |
| return allBadges.length > 0 ? allBadges.map((b) => b.md).join(" ") + " " : ""; |
The
README.mdhas been updated to includenpm versionandnpm downloadsbadges in the main section by default. This was achieved by removing them from theexcludeBadgesoption in thedoc-genconfiguration.To maintain a concise initial view, the
starsandforksbadges have been moved into the collapsed 'More badges' section.Additionally, a debugging
console.logstatement forexcludeBadgeswas removed fromindex.js, and a trailing space was added to the badge output inindex.jswhen badges are not collapsed, ensuring better markdown formatting.