Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit 005d39f

Browse files
committed
fix: nitro
1 parent 0d6dd96 commit 005d39f

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

components/Graph.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ const container = ref<HTMLElement>()
2020
const data = computed<Data>(() => {
2121
/** Selection */
2222
const selectionNodes: Data['nodes'] = props.selection.map((select) => {
23+
const logo = props.packages.find((pkg) => {
24+
return pkg.name === select
25+
})?.title
26+
2327
return {
2428
id: select,
2529
label: select,
26-
image: `https://unjs.io/assets/logos/${select}.svg`,
30+
image: `https://unjs.io/assets/logos/${logo}.svg`,
2731
group: 'selection',
2832
}
2933
})
@@ -105,10 +109,14 @@ const data = computed<Data>(() => {
105109
})
106110
107111
const allDependenciesNodes: Data['nodes'] = dedupedWithoutSelectionAllDependencies.flatMap((dep) => {
112+
const logo = props.packages.find((pkg) => {
113+
return pkg.name === dep
114+
})?.title
115+
108116
return {
109117
id: dep,
110118
label: dep,
111-
image: `https://unjs.io/assets/logos/${dep}.svg`,
119+
image: `https://unjs.io/assets/logos/${logo}.svg`,
112120
group: 'dependencies',
113121
}
114122
})

pages/index.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ const resultsPackages = computed(() => {
4949
return packages.value.filter(p => p.includes(query.value))
5050
})
5151
52+
function getLogo(packageName: string): string {
53+
const logo = pkg.value!.find(p => p.name === packageName)?.title
54+
return `https://unjs.io/assets/logos/${logo}.svg`
55+
}
56+
57+
function getGitHubLink(packageName: string): string {
58+
const repoName = pkg.value!.find(p => p.name === packageName)?.title
59+
return `https//github.com/unjs/${repoName}`
60+
}
61+
5262
function resetSelection() {
5363
selectedPackages.value = []
5464
}
@@ -105,7 +115,7 @@ const lessXl = breakpoints.smaller('xl')
105115
<ComboboxOption v-for="item in resultsPackages" :key="item" v-slot="{ active, selected }" as="template" :value="item">
106116
<li class="cursor-pointer px-1 py-1 w-full flex items-center justify-between rounded-md transition ease-in" :class="{ 'bg-gray-300/40': active }">
107117
<span class="flex items-center gap-2">
108-
<UAvatar :src="`https://unjs.io/assets/logos/${item}.svg`" :alt="`Logo of ${item}`" size="xs" :ui="{ rounded: '' }" />
118+
<UAvatar :src="getLogo(item)" :alt="`Logo of ${item}`" size="xs" :ui="{ rounded: '' }" />
109119
<span>
110120
{{ item }}
111121
</span>
@@ -179,7 +189,7 @@ const lessXl = breakpoints.smaller('xl')
179189
{{ slideOverPackage?.name }}
180190
</h2>
181191

182-
<UButton icon="i-simple-icons-github" label="View on GitHub" :to="`https://github.com/unjs/${slideOverPackage.name}`" target="_blank" variant="ghost" color="gray" />
192+
<UButton icon="i-simple-icons-github" label="View on GitHub" :to="`https://github.com/unjs/${slideOverPackage.title}`" target="_blank" variant="ghost" color="gray" />
183193
</template>
184194

185195
<div class="prose">
@@ -200,7 +210,7 @@ const lessXl = breakpoints.smaller('xl')
200210
<UTooltip text="View relations">
201211
<UButton icon="i-ph-graph" variant="ghost" color="gray" @click="openInRelations(dep)" />
202212
</UTooltip>
203-
<UButton icon="i-simple-icons-github" :to="`https://github.com/unjs/${dep}`" target="_blank" variant="ghost" color="gray" />
213+
<UButton icon="i-simple-icons-github" :to="getGitHubLink(dep)" target="_blank" variant="ghost" color="gray" />
204214
</span>
205215
</span>
206216
</li>
@@ -224,7 +234,7 @@ const lessXl = breakpoints.smaller('xl')
224234
<UTooltip text="View relations">
225235
<UButton icon="i-ph-graph" variant="ghost" color="gray" @click="openInRelations(dep)" />
226236
</UTooltip>
227-
<UButton icon="i-simple-icons-github" :to="`https://github.com/unjs/${dep}`" target="_blank" variant="ghost" color="gray" />
237+
<UButton icon="i-simple-icons-github" :to="getGitHubLink(dep)" target="_blank" variant="ghost" color="gray" />
228238
</span>
229239
</span>
230240
</li>

server/api/packages.json.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default defineEventHandler(async (event) => {
1111
return npmPackages.map(({ package: pkg }) => {
1212
return {
1313
name: pkg.name,
14+
title: packages.find(p => p.npm?.name === pkg.name)?.title,
1415
description: pkg.description,
1516
dependencies: Object.keys(pkg.dependencies || {}).filter(dep => packageNames.includes(dep)),
1617
devDependencies: Object.keys(pkg.devDependencies || {}).filter(dep => packageNames.includes(dep)),

0 commit comments

Comments
 (0)