From 58a2fda9ac7b7e7b3fbd2497b3cc347d91f2137a Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 4 Aug 2026 20:55:22 +0800 Subject: [PATCH 1/2] feat: add deprecated marking to package timeline page --- .../[[org]]/[packageName].vue | 72 ++++++++++++++----- i18n/locales/en.json | 1 + i18n/locales/zh-CN.json | 3 +- i18n/locales/zh-TW.json | 3 +- i18n/schema.json | 3 + server/api/registry/timeline/[...pkg].get.ts | 2 + 6 files changed, 63 insertions(+), 21 deletions(-) diff --git a/app/pages/package-timeline/[[org]]/[packageName].vue b/app/pages/package-timeline/[[org]]/[packageName].vue index a86c3f2af3..284deb23cb 100644 --- a/app/pages/package-timeline/[[org]]/[packageName].vue +++ b/app/pages/package-timeline/[[org]]/[packageName].vue @@ -332,6 +332,13 @@ const versionSubEvents = computed(() => { return result }) +// The latest deprecated version — the first deprecated entry by publish time. +// npm registry doesn't record a separate deprecation timestamp, so the badge +// is shown once on the newest deprecated release only. +const latestDeprecatedVersion = computed( + () => timelineEntries.value.find(e => e.deprecated) ?? null, +) + const selectedVersion = shallowRef(null) useSeoMeta({ @@ -375,7 +382,7 @@ useSeoMeta({ :class="entry.version === version ? 'bg-accent border-accent' : 'bg-bg-subtle'" /> -
+
{{ tag }} + +
    + +
  1. -
diff --git a/i18n/locales/en.json b/i18n/locales/en.json index a09e22b59f..1a40d75f8a 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -646,6 +646,7 @@ "trusted_publisher_removed": "Trusted publishing removed", "provenance_added": "Provenance enabled", "provenance_removed": "Provenance removed", + "deprecated": "Deprecated", "chart": { "tab_aria_label": "Metric selection", "dependency_size": "Dependency Size", diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index 99d9019d6a..e779211a4a 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -601,7 +601,8 @@ "version_events": "版本 {version}:{events}", "general_description": "折线图展示了 {package} 包从版本 {first} 到 {last} 的 {metric} 变化情况。版本 {first} 的 {metric} 为 {first_value},版本 {last} 为 {last_value}(整体变化 {overall_progress_percentage}%)。{key_changes} {watermark}。" } - } + }, + "deprecated": "已弃用" }, "dependencies": { "title": "依赖({count} 个)", diff --git a/i18n/locales/zh-TW.json b/i18n/locales/zh-TW.json index e2b15eefb7..7fd55b3975 100644 --- a/i18n/locales/zh-TW.json +++ b/i18n/locales/zh-TW.json @@ -555,7 +555,8 @@ "timeline": { "chart": { "copy_alt": {} - } + }, + "deprecated": "已棄用" }, "dependencies": { "title": "相依({count} 個)", diff --git a/i18n/schema.json b/i18n/schema.json index b7793e498c..3dc9c82476 100644 --- a/i18n/schema.json +++ b/i18n/schema.json @@ -1942,6 +1942,9 @@ "provenance_removed": { "type": "string" }, + "deprecated": { + "type": "string" + }, "chart": { "type": "object", "properties": { diff --git a/server/api/registry/timeline/[...pkg].get.ts b/server/api/registry/timeline/[...pkg].get.ts index cd399ef3c8..b12594465c 100644 --- a/server/api/registry/timeline/[...pkg].get.ts +++ b/server/api/registry/timeline/[...pkg].get.ts @@ -11,6 +11,7 @@ export interface TimelineVersion { hasTypes?: boolean hasTrustedPublisher?: boolean hasProvenance?: boolean + deprecated?: string tags: string[] } @@ -79,6 +80,7 @@ export default defineCachedEventHandler( // oxlint-disable-next-line eslint/no-underscore-dangle hasTrustedPublisher: version._npmUser?.trustedPublisher ? true : undefined, hasProvenance: version.dist?.attestations ? true : undefined, + deprecated: version.deprecated || undefined, tags: tagsByVersion.get(v) ?? [], } }) From 5a24cecae8319432623a11e3b85eca9e768a3b79 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 4 Aug 2026 21:26:56 +0800 Subject: [PATCH 2/2] fix: update --- .../package-timeline/[[org]]/[packageName].vue | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/app/pages/package-timeline/[[org]]/[packageName].vue b/app/pages/package-timeline/[[org]]/[packageName].vue index 284deb23cb..5dac1ec9a0 100644 --- a/app/pages/package-timeline/[[org]]/[packageName].vue +++ b/app/pages/package-timeline/[[org]]/[packageName].vue @@ -332,13 +332,6 @@ const versionSubEvents = computed(() => { return result }) -// The latest deprecated version — the first deprecated entry by publish time. -// npm registry doesn't record a separate deprecation timestamp, so the badge -// is shown once on the newest deprecated release only. -const latestDeprecatedVersion = computed( - () => timelineEntries.value.find(e => e.deprecated) ?? null, -) - const selectedVersion = shallowRef(null) useSeoMeta({ @@ -404,7 +397,7 @@ useSeoMeta({ {{ tag }}
    - +