Skip to content

Commit 427133a

Browse files
committed
Merge branch 'main' of github.com:harlan-zw/fork-npmx.dev into feat/og-image-v7
2 parents 5aa85f6 + ca5e399 commit 427133a

File tree

19 files changed

+1461
-23
lines changed

19 files changed

+1461
-23
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: "\U0001F41E Bug report"
22
description: Create a report to help us improve npmx
3+
type: bug
4+
labels: ['pending triage']
35
body:
46
- type: markdown
57
attributes:

.github/ISSUE_TEMPLATE/feature-request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: '🚀 Feature request'
22
description: Suggest a feature that will improve npmx
3+
type: feature
34
labels: ['pending triage']
45
body:
56
- type: markdown

app/components/AppFooter.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ const closeModal = () => modalRef.value?.close?.()
120120
<kbd class="kbd">f</kbd>
121121
<span>{{ $t('shortcuts.open_diff') }}</span>
122122
</li>
123+
<li class="flex gap-2 items-center">
124+
<kbd class="kbd">t</kbd>
125+
<span>{{ $t('shortcuts.open_timeline') }}</span>
126+
</li>
123127
<li class="flex gap-2 items-center">
124128
<kbd class="kbd">c</kbd>
125129
<span>{{ $t('shortcuts.compare_from_package') }}</span>

app/components/Chart/SplitSparkline.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const props = defineProps<{
3131
3232
const { locale } = useI18n()
3333
const colorMode = useColorMode()
34+
const numberFormatter = useNumberFormatter({
35+
maximumFractionDigits: 0,
36+
})
3437
const resolvedMode = shallowRef<'light' | 'dark'>('light')
3538
const rootEl = shallowRef<HTMLElement | null>(null)
3639
const palette = getPalette('')
@@ -153,6 +156,9 @@ const configs = computed(() => {
153156
fontSize: 24,
154157
bold: false,
155158
color: colors.value.fg,
159+
formatter: ({ value }) => {
160+
return numberFormatter.value.format(value)
161+
},
156162
datetimeFormatter: {
157163
enable: true,
158164
locale: locale.value,

app/components/Package/Header.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const props = defineProps<{
1010
latestVersion?: SlimVersion | null
1111
provenanceData?: ProvenanceDetails | null
1212
provenanceStatus?: string | null
13-
page: 'main' | 'docs' | 'code' | 'diff'
13+
page: 'main' | 'docs' | 'code' | 'diff' | 'timeline'
1414
versionUrlPattern: string
1515
}>()
1616
@@ -162,12 +162,26 @@ const diffLink = computed((): RouteLocationRaw | null => {
162162
return diffRoute(props.pkg.name, props.resolvedVersion, props.latestVersion.version)
163163
})
164164
165+
const timelineLink = computed((): RouteLocationRaw | null => {
166+
if (props.pkg == null || props.resolvedVersion == null) return null
167+
const split = props.pkg.name.split('/')
168+
return {
169+
name: 'timeline',
170+
params: {
171+
org: split.length === 2 ? split[0] : undefined,
172+
packageName: split.length === 2 ? split[1]! : split[0]!,
173+
version: props.resolvedVersion,
174+
},
175+
}
176+
})
177+
165178
useShortcuts({
166179
'.': () => codeLink.value,
167180
'm': () => mainLink.value,
168181
'd': () => docsLink.value,
169182
'c': () => props.pkg && { name: 'compare' as const, query: { packages: props.pkg.name } },
170183
'f': () => diffLink.value,
184+
't': () => timelineLink.value,
171185
})
172186
</script>
173187

@@ -330,6 +344,15 @@ useShortcuts({
330344
>
331345
{{ $t('compare.compare_versions') }}
332346
</LinkBase>
347+
<LinkBase
348+
v-if="timelineLink"
349+
:to="timelineLink"
350+
aria-keyshortcuts="t"
351+
class="decoration-none border-b-2 p-1 hover:border-accent/50 focus-visible:[outline-offset:-2px]!"
352+
:class="page === 'timeline' ? 'border-accent text-accent!' : 'border-transparent'"
353+
>
354+
{{ $t('package.links.timeline') }}
355+
</LinkBase>
333356
</nav>
334357
</div>
335358
</div>

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ function handleModalTransitioned() {
6060
}
6161
6262
const { fetchPackageDownloadEvolution } = useCharts()
63-
const numberFormatter = useNumberFormatter()
63+
const numberFormatter = useNumberFormatter({
64+
maximumFractionDigits: 0,
65+
})
6466
6567
const { accentColors, selectedAccentColor } = useAccentColor()
6668

app/composables/npm/usePackage.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,20 @@ export function transformPackument(
8686
const trustLevel = getTrustLevel(version)
8787
const hasProvenance = trustLevel !== 'none'
8888

89+
// Normalize license: some versions use { type: "MIT" } instead of "MIT"
90+
let versionLicense = version.license
91+
if (versionLicense && typeof versionLicense === 'object' && 'type' in versionLicense) {
92+
versionLicense = (versionLicense as { type: string }).type
93+
}
94+
8995
filteredVersions[v] = {
9096
hasProvenance,
9197
trustLevel,
9298
version: version.version,
9399
deprecated: version.deprecated,
94100
tags: version.tags as string[],
101+
license: typeof versionLicense === 'string' ? versionLicense : undefined,
102+
type: typeof version.type === 'string' ? version.type : undefined,
95103
}
96104
}
97105
}

app/composables/useSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const DEFAULT_SETTINGS: AppSettings = {
7373
},
7474
chartFilter: {
7575
averageWindow: 0,
76-
smoothingTau: 1,
76+
smoothingTau: 0,
7777
anomaliesFixed: true,
7878
predictionPoints: 4,
7979
},

0 commit comments

Comments
 (0)