Skip to content

Commit 00a8487

Browse files
committed
feat: add "v" before version number on badges
In other places, we show package version number with "v" prefix, which also helps recognizing what number we're actually looking at.
1 parent 7fe73b0 commit 00a8487

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

server/api/registry/badge/[type]/[...pkg].get.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ async function fetchInstallSize(packageName: string, version: string): Promise<n
123123

124124
const badgeStrategies = {
125125
'version': async (pkgData: globalThis.Packument, requestedVersion?: string) => {
126-
const value = requestedVersion ?? getLatestVersion(pkgData) ?? 'unknown'
127-
return { label: 'version', value, color: COLORS.blue }
126+
const version = requestedVersion ?? getLatestVersion(pkgData) ?? 'unknown'
127+
return {
128+
label: 'version',
129+
value: version === 'unknown' ? version : `v${version}`,
130+
color: COLORS.blue,
131+
}
128132
},
129133

130134
'license': async (pkgData: globalThis.Packument) => {

0 commit comments

Comments
 (0)