Skip to content

Commit 68690ad

Browse files
committed
feat: add trust/provenance
Aw yeah!
1 parent 06878f0 commit 68690ad

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

app/pages/package-timeline/[[org]]/[packageName].vue

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,40 @@ const versionSubEvents = computed(() => {
240240
})
241241
}
242242
243+
// Trusted publisher changes
244+
if (current.hasTrustedPublisher && !previous.hasTrustedPublisher) {
245+
events.push({
246+
key: 'trustedPublisher',
247+
positive: true,
248+
icon: 'i-lucide:shield-check',
249+
text: t('package.timeline.trusted_publisher_added'),
250+
})
251+
} else if (!current.hasTrustedPublisher && previous.hasTrustedPublisher) {
252+
events.push({
253+
key: 'trustedPublisher',
254+
positive: false,
255+
icon: 'i-lucide:shield-off',
256+
text: t('package.timeline.trusted_publisher_removed'),
257+
})
258+
}
259+
260+
// Provenance changes
261+
if (current.hasProvenance && !previous.hasProvenance) {
262+
events.push({
263+
key: 'provenance',
264+
positive: true,
265+
icon: 'i-lucide:fingerprint',
266+
text: t('package.timeline.provenance_added'),
267+
})
268+
} else if (!current.hasProvenance && previous.hasProvenance) {
269+
events.push({
270+
key: 'provenance',
271+
positive: false,
272+
icon: 'i-lucide:fingerprint',
273+
text: t('package.timeline.provenance_removed'),
274+
})
275+
}
276+
243277
if (events.length) {
244278
result.set(current.version, events)
245279
}

i18n/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,11 @@
455455
"esm_added": "Module type changed to ESM",
456456
"esm_removed": "Module type changed from ESM to CJS",
457457
"types_added": "TypeScript types added",
458-
"types_removed": "TypeScript types removed"
458+
"types_removed": "TypeScript types removed",
459+
"trusted_publisher_added": "Trusted publishing enabled",
460+
"trusted_publisher_removed": "Trusted publishing removed",
461+
"provenance_added": "Provenance enabled",
462+
"provenance_removed": "Provenance removed"
459463
},
460464
"dependencies": {
461465
"title": "Dependency ({count}) | Dependencies ({count})",

i18n/schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,18 @@
13711371
},
13721372
"types_removed": {
13731373
"type": "string"
1374+
},
1375+
"trusted_publisher_added": {
1376+
"type": "string"
1377+
},
1378+
"trusted_publisher_removed": {
1379+
"type": "string"
1380+
},
1381+
"provenance_added": {
1382+
"type": "string"
1383+
},
1384+
"provenance_removed": {
1385+
"type": "string"
13741386
}
13751387
},
13761388
"additionalProperties": false

server/api/registry/timeline/[...pkg].get.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface TimelineVersion {
88
license?: string
99
type?: string
1010
hasTypes?: boolean
11+
hasTrustedPublisher?: boolean
12+
hasProvenance?: boolean
1113
tags: string[]
1214
}
1315

@@ -71,6 +73,8 @@ export default defineCachedEventHandler(
7173
license: typeof license === 'string' ? license : undefined,
7274
type: typeof version.type === 'string' ? version.type : undefined,
7375
hasTypes: hasBuiltInTypes(version) || undefined,
76+
hasTrustedPublisher: version._npmUser?.trustedPublisher ? true : undefined,
77+
hasProvenance: version.dist?.attestations ? true : undefined,
7478
tags: tagsByVersion.get(v) ?? [],
7579
}
7680
})

0 commit comments

Comments
 (0)