Skip to content

Commit e74c83b

Browse files
committed
feat: add npmjs.dev to playground links (#2314)
1 parent f70a11b commit e74c83b

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

app/pages/package/[[org]]/[name].vue

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,33 @@ const { data: readmeData } = useLazyFetch<ReadmeResponse>(
6363
},
6464
)
6565
66-
const playgroundLinks = computed(() => [
67-
...readmeData.value.playgroundLinks,
66+
const playgroundLinks = computed(() => {
67+
const links = [...readmeData.value.playgroundLinks]
68+
69+
const packageData = pkg.value
70+
if (!packageData) {
71+
return links
72+
}
73+
6874
// Libraries with a storybook field in package.json contain a link to their deployed playground
69-
...(pkg.value?.storybook?.url
70-
? [
71-
{
72-
url: pkg.value.storybook.url,
73-
provider: 'storybook',
74-
providerName: 'Storybook',
75-
label: 'Storybook',
76-
},
77-
]
78-
: []),
79-
])
75+
if (packageData.storybook?.url) {
76+
links.push({
77+
url: packageData.storybook.url,
78+
provider: 'storybook',
79+
providerName: 'Storybook',
80+
label: 'Storybook',
81+
})
82+
}
83+
84+
links.push({
85+
url: `https://npmjs.dev/${packageData.name}`,
86+
provider: 'npmjs.dev',
87+
providerName: 'npmjs.dev',
88+
label: 'npmjs.dev',
89+
})
90+
91+
return links
92+
})
8093
8194
const {
8295
data: readmeMarkdownData,

0 commit comments

Comments
 (0)