Skip to content

Commit 6c5113d

Browse files
serhalpdanielroeautofix-ci[bot]
authored andcommitted
fix: use version publish date instead of misleading time.modified (npmx-dev#702)
Co-authored-by: Daniel Roe <daniel@roe.dev> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 886f621 commit 6c5113d

48 files changed

Lines changed: 266 additions & 237 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/components/ColumnPicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const columnLabelKey: Record<string, string> = {
4242
version: 'filters.columns.version',
4343
description: 'filters.columns.description',
4444
downloads: 'filters.columns.downloads',
45-
updated: 'filters.columns.updated',
45+
updated: 'filters.columns.published',
4646
maintainers: 'filters.columns.maintainers',
4747
keywords: 'filters.columns.keywords',
4848
qualityScore: 'filters.columns.quality_score',

app/components/Package/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const pkgDescription = useMarkdown(() => ({
9494
<dd class="font-mono">{{ result.package.publisher.username }}</dd>
9595
</div>
9696
<div v-if="result.package.date" class="flex items-center gap-1.5">
97-
<dt class="sr-only">{{ $t('package.card.updated') }}</dt>
97+
<dt class="sr-only">{{ $t('package.card.published') }}</dt>
9898
<dd>
9999
<DateTime
100100
:datetime="result.package.date"

app/components/Package/ListControls.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const sortOptions = computed(
3333
() =>
3434
[
3535
{ value: 'downloads', label: $t('package.sort.downloads') },
36-
{ value: 'updated', label: $t('package.sort.updated') },
36+
{ value: 'updated', label: $t('package.sort.published') },
3737
{ value: 'name-asc', label: $t('package.sort.name_asc') },
3838
{ value: 'name-desc', label: $t('package.sort.name_desc') },
3939
] as const,

app/components/Package/ListToolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const sortKeyLabelKeys: Record<SortKey, string> = {
9191
'downloads-day': 'filters.sort.downloads_day',
9292
'downloads-month': 'filters.sort.downloads_month',
9393
'downloads-year': 'filters.sort.downloads_year',
94-
'updated': 'filters.sort.updated',
94+
'updated': 'filters.sort.published',
9595
'name': 'filters.sort.name',
9696
'quality': 'filters.sort.quality',
9797
'popularity': 'filters.sort.popularity',

app/components/Package/Skeleton.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
</dd>
7171
</div>
7272

73-
<!-- Updated -->
73+
<!-- Published -->
7474
<div class="space-y-1 col-span-2">
7575
<dt class="text-xs text-fg-subtle uppercase tracking-wider">
76-
{{ $t('package.skeleton.updated') }}
76+
{{ $t('package.skeleton.published') }}
7777
</dt>
7878
<dd class="font-mono text-sm">
7979
<span class="skeleton inline-block h-5 w-28" />

app/components/Package/Table.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const columnLabelKeys: Record<ColumnId, string> = {
8585
version: 'filters.columns.version',
8686
description: 'filters.columns.description',
8787
downloads: 'filters.columns.downloads',
88-
updated: 'filters.columns.updated',
88+
updated: 'filters.columns.published',
8989
maintainers: 'filters.columns.maintainers',
9090
keywords: 'filters.columns.keywords',
9191
qualityScore: 'filters.columns.quality_score',

app/composables/usePackageComparison.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export interface PackageComparisonData {
2121
}
2222
metadata?: {
2323
license?: string
24+
/**
25+
* Publish date of this version (ISO 8601 date-time string).
26+
* Uses `time[version]` from the registry, NOT `time.modified`.
27+
* For example, if the package was most recently published 3 years ago
28+
* but a maintainer was removed last week, this would show the '3 years ago' time.
29+
*/
2430
lastUpdated?: string
2531
engines?: { node?: string; npm?: string }
2632
deprecated?: string
@@ -133,7 +139,9 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
133139
},
134140
metadata: {
135141
license: pkgData.license,
136-
lastUpdated: pkgData.time?.modified,
142+
// Use version-specific publish time, NOT time.modified (which can be
143+
// updated by metadata changes like maintainer additions)
144+
lastUpdated: pkgData.time?.[latestVersion],
137145
engines: analysis?.engines,
138146
deprecated: versionData?.deprecated,
139147
},

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,23 @@ function handleClick(event: MouseEvent) {
863863
</template>
864864
</ClientOnly>
865865

866-
<div v-if="pkg.time?.modified" class="space-y-1 sm:col-span-2">
867-
<dt class="text-xs text-fg-subtle uppercase tracking-wider">
868-
{{ $t('package.stats.updated') }}
866+
<div
867+
v-if="resolvedVersion && pkg.time?.[resolvedVersion]"
868+
class="space-y-1 sm:col-span-2"
869+
>
870+
<dt
871+
class="text-xs text-fg-subtle uppercase tracking-wider"
872+
:title="
873+
$t('package.stats.published_tooltip', {
874+
package: pkg.name,
875+
version: resolvedVersion,
876+
})
877+
"
878+
>
879+
{{ $t('package.stats.published') }}
869880
</dt>
870881
<dd class="font-mono text-sm text-fg">
871-
<DateTime :datetime="pkg.time.modified" date-style="medium" />
882+
<DateTime :datetime="pkg.time[resolvedVersion]!" date-style="medium" />
872883
</dd>
873884
</div>
874885
</dl>
@@ -878,7 +889,7 @@ function handleClick(event: MouseEvent) {
878889
<PackageSkillsModal
879890
:skills="skillsData?.skills ?? []"
880891
:package-name="pkg.name"
881-
:version="displayVersion?.version"
892+
:version="resolvedVersion || undefined"
882893
/>
883894
</ClientOnly>
884895
</section>
@@ -1033,7 +1044,7 @@ function handleClick(event: MouseEvent) {
10331044
v-if="skillsData?.skills?.length"
10341045
:skills="skillsData.skills"
10351046
:package-name="pkg.name"
1036-
:version="displayVersion?.version"
1047+
:version="resolvedVersion || undefined"
10371048
/>
10381049
</ClientOnly>
10391050

i18n/locales/ar.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
"deps": "الاعتماديات",
143143
"install_size": "حجم التثبيت",
144144
"vulns": "الثغرات",
145-
"updated": "آخر تحديث",
146145
"skills": "المهارات",
147146
"view_dependency_graph": "عرض مخطط الاعتماديات",
148147
"inspect_dependency_tree": "فحص شجرة الاعتماديات",
@@ -206,7 +205,6 @@
206205
"compatibility": "التوافق",
207206
"card": {
208207
"publisher": "الناشر",
209-
"updated": "آخر تحديث",
210208
"weekly_downloads": "التنزيلات الأسبوعية",
211209
"keywords": "الكلمات المفتاحية",
212210
"license": "الترخيص"
@@ -366,7 +364,6 @@
366364
"weekly": "أسبوعيًا",
367365
"size": "الحجم",
368366
"deps": "الاعتماديات",
369-
"updated": "آخر تحديث",
370367
"get_started": "ابدأ",
371368
"readme": "README",
372369
"maintainers": "المشرفون",
@@ -376,7 +373,6 @@
376373
},
377374
"sort": {
378375
"downloads": "الأكثر تنزيلًا",
379-
"updated": "مُحدَّثة مؤخرًا",
380376
"name_asc": "الاسم (A-Z)",
381377
"name_desc": "الاسم (Z-A)"
382378
}
@@ -661,7 +657,6 @@
661657
"downloads_day": "التنزيلات/اليوم",
662658
"downloads_month": "التنزيلات/الشهر",
663659
"downloads_year": "التنزيلات/السنة",
664-
"updated": "آخر تحديث",
665660
"name": "الاسم",
666661
"quality": "الجودة",
667662
"popularity": "الشعبية",
@@ -677,7 +672,6 @@
677672
"version": "الإصدار",
678673
"description": "الوصف",
679674
"downloads": "التنزيلات/الأسبوع",
680-
"updated": "آخر تحديث",
681675
"maintainers": "المشرفون",
682676
"keywords": "الكلمات المفتاحية",
683677
"quality_score": "درجة الجودة",

i18n/locales/az.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
"deps": "Asılılıqlar",
130130
"install_size": "Quraşdırma Həcmi",
131131
"vulns": "Zəifliklər",
132-
"updated": "Yenilənib",
133132
"view_dependency_graph": "Asılılıq qrafikini göstər",
134133
"inspect_dependency_tree": "Asılılıq ağacını yoxla",
135134
"size_tooltip": {
@@ -176,7 +175,6 @@
176175
"compatibility": "Uyğunluq",
177176
"card": {
178177
"publisher": "Naşir",
179-
"updated": "Yenilənib",
180178
"weekly_downloads": "Həftəlik endirmələr",
181179
"keywords": "Açar sözlər",
182180
"license": "Lisenziya"
@@ -330,7 +328,6 @@
330328
"weekly": "Həftəlik",
331329
"size": "Həcm",
332330
"deps": "Asılılıqlar",
333-
"updated": "Yenilənib",
334331
"get_started": "Başla",
335332
"readme": "Readme",
336333
"maintainers": "Dəstəkçilər",
@@ -340,7 +337,6 @@
340337
},
341338
"sort": {
342339
"downloads": "Ən çox endirilən",
343-
"updated": "Son yenilənən",
344340
"name_asc": "Ad (A-Z)",
345341
"name_desc": "Ad (Z-A)"
346342
}
@@ -620,7 +616,6 @@
620616
"downloads_day": "Endirmələr/gün",
621617
"downloads_month": "Endirmələr/ay",
622618
"downloads_year": "Endirmələr/il",
623-
"updated": "Son Yenilənmə",
624619
"name": "Ad",
625620
"quality": "Keyfiyyət",
626621
"popularity": "Populyarlıq",
@@ -636,7 +631,6 @@
636631
"version": "Versiya",
637632
"description": "Təsvir",
638633
"downloads": "Endirmələr/həftə",
639-
"updated": "Son Yenilənmə",
640634
"maintainers": "Dəstəkçilər",
641635
"keywords": "Açar sözlər",
642636
"quality_score": "Keyfiyyət xalı",

0 commit comments

Comments
 (0)