-
-
Notifications
You must be signed in to change notification settings - Fork 473
feat: add provenance to end of README and provenance badge #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 25 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
91d3b99
feat: add `AppPopover` component
AscaL c9cc109
feat(constants): add error constant for provenance fetch failure
AscaL c19f8ef
feat(i18n): add provenance section to english
AscaL 4b142f4
feat: add `PackageProvenanceSection` component
AscaL 64f9601
feat(types): add `ProvenanceDetails` type
AscaL cc60590
feat(provenance): add provenance utility functions
AscaL 0927569
style(PackageProvenanceSection): add mt spacing
AscaL 2c99239
feat(provenance): add api endpoint for provenance details
AscaL e6bb3e2
feat(package): add provenance and popover to package
AscaL 723ee08
docs(README): update provenance description
AscaL d9408b5
Merge remote-tracking branch 'origin' into feature/provenance
AscaL 9c1c0fd
[autofix.ci] apply automated fixes
autofix-ci[bot] 86530fc
fix(AppPopover): a11y issues
AscaL 1df3da5
fix(provenance): a11y and hydration issues
AscaL 0ce8e20
fix(Popover): use shallowref
AscaL 4fe71b7
fix: use shallowRef
AscaL 558f331
feat(AppPopover): timeout not reactive
AscaL 0c65073
fix(AppPopover): remove .value for timeout
AscaL dc02155
style(PackageProvenanceSection): improve styling for provenance section
AscaL b5d0e08
Merge branch 'feature/provenance' of https://github.com/AscaL/npmx.de…
AscaL aa5c739
Merge branch 'main' into feature/provenance
AscaL 0490129
[autofix.ci] apply automated fixes
autofix-ci[bot] 73169c0
Merge branch 'main' into feature/provenance
AscaL b9fd47e
merge: resolve conflicts with main
danielroe f95b9cb
Merge remote-tracking branch 'origin/main' into feature/provenance
danielroe 121ebeb
chore: merge remote-tracking branch 'origin' into feature/provenance
AscaL 8b37de5
Merge branch 'npmx-dev:main' into feature/provenance
AscaL 4df6684
test(a11y): add accessibility tests for AppPopover and PackageProvena…
AscaL 49152ff
feat(package): add back provenance popover
AscaL 23582b9
fix(PackageProvenanceSection): remove link to npm and props
AscaL c5e939e
chore: merge remote-tracking branch 'origin' into feature/provenance
AscaL a7b1e22
Merge branch 'main' into feature/provenance
AscaL fed4af5
feat(a11y): add accessible label to AppPopover
AscaL b632fe3
chore: merge branch 'feature/provenance' of https://github.com/AscaL/…
AscaL 7c1e4de
Merge branch 'main' into feature/provenance
AscaL 2e6a643
Merge branch 'main' into feature/provenance
AscaL 1495782
[autofix.ci] apply automated fixes
autofix-ci[bot] 880b091
feat: use tooltip for provenance badge
AscaL 392c73e
refactor: update provenance section with i18n keypath
AscaL fa236e6
fix: 404 on missing pkg version
AscaL 697a85b
chore: merge remote-tracking branch 'origin' into feature/provenance
AscaL 38f4d00
Merge branch 'main' into feature/provenance
AscaL 2c32786
Merge remote-tracking branch 'origin/main' into feature/provenance
danielroe c77a400
fix: update icons
danielroe 4f22aea
fix: error handling
danielroe 43bb79a
fix: also handle refs/tags publishing
danielroe 1175730
fix: cache provenance permanently
danielroe 81a644c
fix: merge conflict
danielroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| <script setup lang="ts"> | ||
| const props = defineProps<{ | ||
| /** Position of the popover panel: 'top' | 'bottom' | 'left' | 'right' */ | ||
| position?: 'top' | 'bottom' | 'left' | 'right' | ||
| }>() | ||
|
|
||
| const isOpen = shallowRef(false) | ||
| const popoverId = useId() | ||
| let closeTimeout: NodeJS.Timeout | null = null | ||
|
|
||
| const closeDelayMs = 500 | ||
|
|
||
| // Panel placement relative to trigger | ||
| const panelPositionClasses: Record<string, string> = { | ||
| top: 'bottom-full left-1/2 -translate-x-1/2', | ||
| bottom: 'top-full left-1/2 -translate-x-1/2', | ||
| left: 'right-full top-1/2 -translate-y-1/2', | ||
| right: 'left-full top-1/2 -translate-y-1/2', | ||
| } | ||
|
|
||
| const panelPosition = computed(() => panelPositionClasses[props.position ?? 'bottom']) | ||
|
|
||
| function clearCloseTimeout() { | ||
| if (closeTimeout !== null) { | ||
| clearTimeout(closeTimeout) | ||
| closeTimeout = null | ||
| } | ||
| } | ||
|
|
||
| function open() { | ||
| clearCloseTimeout() | ||
| isOpen.value = true | ||
| } | ||
|
|
||
| function close() { | ||
| clearCloseTimeout() | ||
| closeTimeout = setTimeout(() => { | ||
| closeTimeout = null | ||
| isOpen.value = false | ||
| }, closeDelayMs) | ||
| } | ||
|
|
||
| onBeforeUnmount(clearCloseTimeout) | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| class="relative inline-flex" | ||
| @mouseenter="open" | ||
| @mouseleave="close" | ||
| @focusin="open" | ||
| @focusout="close" | ||
| > | ||
| <slot :popover-visible="isOpen" :popover-id="popoverId" /> | ||
|
|
||
| <Transition | ||
| enter-active-class="transition-opacity duration-150 motion-reduce:transition-none" | ||
| leave-active-class="transition-opacity duration-100 motion-reduce:transition-none" | ||
| enter-from-class="opacity-0" | ||
| leave-to-class="opacity-0" | ||
| > | ||
| <div | ||
| v-if="isOpen" | ||
| :id="popoverId" | ||
| role="dialog" | ||
| aria-modal="false" | ||
| class="absolute font-mono text-xs text-fg bg-bg-subtle border border-border rounded-lg shadow-lg z-[100] pointer-events-auto px-4 py-3 min-w-[14rem] max-w-[22rem] whitespace-normal" | ||
| :class="panelPosition" | ||
| @mouseenter="open" | ||
| @mouseleave="close" | ||
| > | ||
| <slot name="content" /> | ||
| </div> | ||
| </Transition> | ||
| </div> | ||
| </template> | ||
|
AscaL marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| <script setup lang="ts"> | ||
| import type { ProvenanceDetails } from '#shared/types' | ||
|
|
||
| defineProps<{ | ||
| /** Parsed provenance details from the API */ | ||
| details: ProvenanceDetails | ||
| /** Optional: link "View on npm" to package provenance page */ | ||
| packageName?: string | ||
| version?: string | ||
| }>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <section id="provenance" aria-labelledby="provenance-heading" class="scroll-mt-20"> | ||
| <h2 id="provenance-heading" class="group text-xs text-fg-subtle uppercase tracking-wider mb-3"> | ||
| <a | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| href="#provenance" | ||
| class="inline-flex items-center gap-1.5 text-fg-subtle hover:text-fg-muted transition-colors duration-200 no-underline" | ||
| > | ||
| {{ $t('package.provenance_section.title') }} | ||
| <span | ||
| class="i-carbon-link w-3 h-3 block opacity-0 group-hover:opacity-100 transition-opacity duration-200" | ||
| aria-hidden="true" | ||
| /> | ||
| </a> | ||
| </h2> | ||
|
|
||
| <div class="space-y-3 border border-border rounded-lg p-5"> | ||
| <p class="flex items-center gap-2 text-sm text-fg m-0"> | ||
| <span | ||
| class="i-solar-shield-check-outline w-4 h-4 shrink-0 text-emerald-500" | ||
| aria-hidden="true" | ||
| /> | ||
| <span | ||
| v-html=" | ||
| $t('package.provenance_section.built_and_signed_on', { | ||
| provider: `<b>${details.providerLabel}</b>`, | ||
| }) | ||
| " | ||
| /> | ||
| </p> | ||
| <a | ||
| v-if="details.buildSummaryUrl" | ||
| :href="details.buildSummaryUrl" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="link text-sm text-fg-muted block mt-1" | ||
| > | ||
| {{ $t('package.provenance_section.view_build_summary') }} | ||
| </a> | ||
|
|
||
| <dl class="m-0 mt-4 flex justify-between"> | ||
| <div v-if="details.sourceCommitUrl" class="flex flex-col gap-0.5"> | ||
| <dt class="font-mono text-xs text-fg-muted m-0"> | ||
| {{ $t('package.provenance_section.source_commit') }} | ||
| </dt> | ||
| <dd class="m-0"> | ||
| <a | ||
| :href="details.sourceCommitUrl" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="link font-mono text-sm break-all" | ||
| > | ||
| {{ | ||
| details.sourceCommitSha | ||
| ? `${details.sourceCommitSha.slice(0, 12)}` | ||
| : details.sourceCommitUrl | ||
| }} | ||
| </a> | ||
| </dd> | ||
| </div> | ||
| <div v-if="details.buildFileUrl" class="flex flex-col gap-0.5"> | ||
| <dt class="font-mono text-xs text-fg-muted m-0"> | ||
| {{ $t('package.provenance_section.build_file') }} | ||
| </dt> | ||
| <dd class="m-0"> | ||
| <a | ||
| :href="details.buildFileUrl" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="link font-mono text-sm break-all" | ||
| > | ||
| {{ details.buildFilePath ?? details.buildFileUrl }} | ||
| </a> | ||
| </dd> | ||
| </div> | ||
| <div v-if="details.publicLedgerUrl" class="flex flex-col gap-0.5"> | ||
| <dt class="font-mono text-xs text-fg-muted m-0"> | ||
| {{ $t('package.provenance_section.public_ledger') }} | ||
| </dt> | ||
| <dd class="m-0"> | ||
| <a | ||
| :href="details.publicLedgerUrl" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="link text-sm" | ||
| > | ||
| {{ $t('package.provenance_section.transparency_log_entry') }} | ||
| </a> | ||
| </dd> | ||
| </div> | ||
| </dl> | ||
| </div> | ||
|
|
||
| <p v-if="packageName && version" class="mt-4 m-0"> | ||
| <a | ||
| :href="`https://www.npmjs.com/package/${packageName}/v/${version}#provenance`" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| class="link-subtle font-mono text-sm" | ||
| > | ||
| {{ $t('common.view_on_npm') }} | ||
| </a> | ||
|
AscaL marked this conversation as resolved.
Outdated
|
||
| </p> | ||
| </section> | ||
| </template> | ||
|
AscaL marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this something that TooltipApp would help us with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems to be done for simple tooltips

while this one has a link inside. I could remove the link and keep the scroll to the #provenance section by clicking the badge if you think that's better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, let's make it a tooltip that just says 'Built and signed on GitHub Actions' (no icon needed, if it's displaying by hovering an icon)
or ... an alternative idea might be to display this as a banner above the readme (like the vulnerability banner) which is expandable with details (and remove the shield from next to the version). that might be a way of freeing up space in this very top area, but it would push the readme further down by a line.
what do you think?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just make it simpler, I think readmes are generally cramped as is, and i am not sure how many people know about provenance... I honestly didn't know it existed till 3 days ago. In my head vulns are much more important and i don't think they deserve the same "space". I guess that is just my personal experience talking.
Plus i think the badge there is just easy to look for, and if it's there you "know".