-
-
Notifications
You must be signed in to change notification settings - Fork 471
feat: add community adoption distribution link in Versions.vue #687
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
Changes from 14 commits
95bd369
361fb7c
27898e1
f6485ec
b5de987
179ec74
eb3ea4c
11d26af
a60127a
1ffcba8
fe1ea89
2e20622
7feb8ad
ba9ea1e
c0aab9a
96732fa
934843c
033ae9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -306,6 +306,18 @@ function getTagVersions(tag: string): VersionDisplay[] { | |||||||||||||||||||||||||||||||||||||||||||||
| :title="$t('package.versions.title')" | ||||||||||||||||||||||||||||||||||||||||||||||
| id="versions" | ||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||
| <template #actions> | ||||||||||||||||||||||||||||||||||||||||||||||
| <a | ||||||||||||||||||||||||||||||||||||||||||||||
| :href="`https://majors.nullvoxpopuli.com/q?packages=${props.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> | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+309
to
+319
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result:
For scoped npm packages, use normal URL-encoding for reserved characters—most importantly:
Example: 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 Scoped package names (e.g. 🔧 Suggested change- :href="`https://majors.nullvoxpopuli.com/q?packages=${packageName}`"
+ :href="`https://majors.nullvoxpopuli.com/q?packages=${encodeURIComponent(packageName)}`"📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||||||||||||||||||||||
| <div class="space-y-0.5 min-w-0"> | ||||||||||||||||||||||||||||||||||||||||||||||
| <!-- Dist-tag rows (limited to MAX_VISIBLE_TAGS) --> | ||||||||||||||||||||||||||||||||||||||||||||||
| <div v-for="row in visibleTagRows" :key="row.id"> | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,10 +73,10 @@ describe('PackageVersions', () => { | |
| }, | ||
| }) | ||
|
|
||
| // 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') | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| .filter(a => !a.attributes('href')?.startsWith('#')) | ||
| .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') | ||
| expect(versionLinks.length).toBeGreaterThan(0) | ||
| expect(versionLinks[0]?.text()).toBe('2.0.0') | ||
| }) | ||
|
|
@@ -93,10 +93,10 @@ describe('PackageVersions', () => { | |
| }, | ||
| }) | ||
|
|
||
| // 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') | ||
| .filter(a => !a.attributes('href')?.startsWith('#')) | ||
| .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') | ||
| expect(versionLinks.length).toBeGreaterThan(0) | ||
| expect(versionLinks[0]?.text()).toBe('1.0.0') | ||
| }) | ||
|
|
@@ -187,10 +187,10 @@ describe('PackageVersions', () => { | |
| }, | ||
| }) | ||
|
|
||
| // 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') | ||
| .filter(a => !a.attributes('href')?.startsWith('#')) | ||
| .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') | ||
| const versions = versionLinks.map(l => l.text()) | ||
| // Should be sorted by version descending | ||
| expect(versions[0]).toBe('2.0.0') | ||
|
|
@@ -210,10 +210,10 @@ describe('PackageVersions', () => { | |
| }, | ||
| }) | ||
|
|
||
| // 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') | ||
| .filter(a => !a.attributes('href')?.startsWith('#')) | ||
| .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') | ||
| expect(versionLinks.length).toBeGreaterThan(0) | ||
| expect(versionLinks[0]?.classes()).toContain('text-red-400') | ||
| }) | ||
|
|
@@ -230,10 +230,10 @@ describe('PackageVersions', () => { | |
| }, | ||
| }) | ||
|
|
||
| // 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') | ||
| .filter(a => !a.attributes('href')?.startsWith('#')) | ||
| .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') | ||
| expect(versionLinks.length).toBeGreaterThan(0) | ||
| expect(versionLinks[0]?.attributes('title')).toContain('deprecated') | ||
| }) | ||
|
|
@@ -562,10 +562,10 @@ describe('PackageVersions', () => { | |
| }, | ||
| }) | ||
|
|
||
| // Count visible version links (excluding anchor links that start with #) | ||
| // Count visible version links (excluding anchor links that start with # and external links) | ||
| const visibleLinks = component | ||
| .findAll('a') | ||
| .filter(a => !a.attributes('href')?.startsWith('#')) | ||
| .filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank') | ||
| // Should have max 10 visible links in the main section | ||
| expect(visibleLinks.length).toBeLessThanOrEqual(10) | ||
| }) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.