feat: add community adoption distribution link in Versions.vue#687
feat: add community adoption distribution link in Versions.vue#687danielroe merged 18 commits intonpmx-dev:mainfrom
Conversation
Added a link to view community adoption distribution for packages.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
[WIP] Fix test errors related to component link update
| // Find version links (exclude anchor links that start with #) | ||
| // Find version links (exclude anchor links that start with # and external links) | ||
| const versionLinks = component | ||
| .findAll('a') |
There was a problem hiding this comment.
filtering all links like this with a semantic wrapper feels a bit goofy, but I don't know what testing patterns are common/recommended, and this was pretty hands off for me. Lemme know what changes you want
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
looks like ci needs to re-run (due to actions outage yesterday) |
📝 WalkthroughWalkthroughThe pull request adds an external link button to the Package Versions component that directs users to a community distribution page. The link is added as an action in the CollapsibleSection header, uses the packageName prop to construct the URL, and includes an icon and accessible label. Supporting translation entries are added to locale files in English (en-GB, en-US variants and main i18n), and component tests are updated to exclude external links when filtering version link elements. 🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| <template #actions> | ||
| <a | ||
| :href="`https://majors.nullvoxpopuli.com/q?packages=${packageName}`" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="text-fg-subtle hover:text-fg transition-colors duration-200 inline-flex items-center justify-center min-w-6 min-h-6 -m-1 p-1" | ||
| :title="$t('package.downloads.community_distribution')" | ||
| > | ||
| <span class="i-carbon:load-balancer-network w-3.5 h-3.5" aria-hidden="true" /> | ||
| <span class="sr-only">{{ $t('package.downloads.community_distribution') }}</span> | ||
| </a> |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
majors.nullvoxpopuli.com package query parameter format scoped packages
💡 Result:
majors.nullvoxpopuli.com reads the package name(s) from the packages query parameter (i.e. ?packages=...). (nullvoxpopuli.com)
For scoped npm packages, use normal URL-encoding for reserved characters—most importantly:
@→%40/→%2F
Example:
https://majors.nullvoxpopuli.com/?packages=%40ember%2Fdata
Citations:
🏁 Script executed:
# Check how packageName is used elsewhere in the codebase
rg "packageName" app/components/Package/Versions.vue -B 2 -A 2 | head -50Repository: npmx-dev/npmx.dev
Length of output: 1625
🏁 Script executed:
# Look for any existing URL encoding patterns in the codebase
rg "encodeURIComponent|encodeURI" --type vue --type ts --type tsx | head -20Repository: npmx-dev/npmx.dev
Length of output: 88
🏁 Script executed:
# Check the package name variable definition and source
rg "const packageName|let packageName|packageName:" app/components/Package/Versions.vue -B 3 -A 1Repository: npmx-dev/npmx.dev
Length of output: 177
Encode packageName in the query string.
Scoped package names (e.g. @scope/package) contain characters like @ and / that must be URL-encoded (%40 and %2F respectively) for the majors.nullvoxpopuli.com service to correctly parse the query parameter.
🔧 Suggested change
- :href="`https://majors.nullvoxpopuli.com/q?packages=${packageName}`"
+ :href="`https://majors.nullvoxpopuli.com/q?packages=${encodeURIComponent(packageName)}`"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <template #actions> | |
| <a | |
| :href="`https://majors.nullvoxpopuli.com/q?packages=${packageName}`" | |
| target="_blank" | |
| rel="noopener noreferrer" | |
| class="text-fg-subtle hover:text-fg transition-colors duration-200 inline-flex items-center justify-center min-w-6 min-h-6 -m-1 p-1" | |
| :title="$t('package.downloads.community_distribution')" | |
| > | |
| <span class="i-carbon:load-balancer-network w-3.5 h-3.5" aria-hidden="true" /> | |
| <span class="sr-only">{{ $t('package.downloads.community_distribution') }}</span> | |
| </a> | |
| <template `#actions`> | |
| <a | |
| :href="`https://majors.nullvoxpopuli.com/q?packages=${encodeURIComponent(packageName)}`" | |
| target="_blank" | |
| rel="noopener noreferrer" | |
| class="text-fg-subtle hover:text-fg transition-colors duration-200 inline-flex items-center justify-center min-w-6 min-h-6 -m-1 p-1" | |
| :title="$t('package.downloads.community_distribution')" | |
| > | |
| <span class="i-carbon:load-balancer-network w-3.5 h-3.5" aria-hidden="true" /> | |
| <span class="sr-only">{{ $t('package.downloads.community_distribution') }}</span> | |
| </a> |
Added a link to view community adoption distribution for packages.
This links out to https://majors.nullvoxpopuli.com to show what majors/minors of a package are being used -- helpful for maintainers to help move their communities forward