feat(ui): add pkg.pr.new preview releases link - #3157
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe package page checks pkg.pr.new for preview releases, resolves a repository-specific URL, and passes it to ChangesPreview release discovery
Sequence Diagram(s)sequenceDiagram
participant PackagePage
participant AvailabilityAPI
participant PkgPrNew
participant PackageVersions
PackagePage->>AvailabilityAPI: Request repository availability
AvailabilityAPI->>PkgPrNew: Send HEAD request
PkgPrNew-->>AvailabilityAPI: Return release header
AvailabilityAPI-->>PackagePage: Return availability and URL
PackagePage->>PackageVersions: Pass preview releases URL
PackageVersions-->>PackagePage: Render link when URL exists
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello! Thank you for opening your first PR to npmx, @AmirSa12! 🚀 Here’s what will happen next:
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/unit/server/api/registry/pkg-pr-new.get.spec.ts (1)
6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace the broad
Functiontype.
Functiondoes not describe the event-handler contract. Use a handler type withH3Eventso this mock remains type-safe.Proposed fix
-vi.stubGlobal('defineCachedEventHandler', (fn: Function) => fn) +vi.stubGlobal( + 'defineCachedEventHandler', + (fn: (event: H3Event) => unknown) => fn, +)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/unit/server/api/registry/pkg-pr-new.get.spec.ts` at line 6, Replace the broad Function annotation in the defineCachedEventHandler stub with an event-handler type that accepts H3Event, preserving the existing passthrough behavior while making the mock type-safe.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/pages/package/`[[org]]/[name].vue:
- Around line 427-474: Restrict the pkg.pr.new preview flow to GitHub
repositories by requiring repoRef.value?.provider === 'github' alongside owner
and repo checks in rawPreviewReleasesUrl, the useAsyncData cache key and fetch
callback, and previewReleasesUrl. Return the existing null/hasReleases-false
defaults for non-GitHub refs so no request or unrelated URL is produced.
In `@server/api/registry/pkg-pr-new.get.ts`:
- Line 28: Update the upstream request in the handler around $fetch.raw to use a
short finite timeout and disable retries with retry: 0, while preserving the
HEAD method. Update the corresponding assertion in pkg-pr-new.get.spec.ts to
expect both request options.
---
Nitpick comments:
In `@test/unit/server/api/registry/pkg-pr-new.get.spec.ts`:
- Line 6: Replace the broad Function annotation in the defineCachedEventHandler
stub with an event-handler type that accepts H3Event, preserving the existing
passthrough behavior while making the mock type-safe.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d74ceba-5e50-470a-8601-a66a6b063767
📒 Files selected for processing (5)
app/components/Package/Versions.vueapp/pages/package/[[org]]/[name].vueserver/api/registry/pkg-pr-new.get.tstest/nuxt/components/Package/Versions.spec.tstest/unit/server/api/registry/pkg-pr-new.get.spec.ts
…pmx.dev into feat/preview-releases
gameroman
left a comment
There was a problem hiding this comment.
I was thinking more of adding a new route similar to /pacakage/... which would allow to view all the info about a published preview package on npmx
That also sounds great! but apparently its been discussed before with Daniel (https://discord.com/channels/1464542801676206113/1508756434937188372/1518531069190738040)
IDK if that has changed or not. |
|
I'd say these are 2 related features but different and could be both implemented One for just detecting and linking to And later we could add an actual route on npmx to view them, where this would later link instead of to |
🔗 Linked issue
closes #3140
🧭 Context
https://discord.com/channels/1464542801676206113/1508756434937188372
📚 Description
I added the necessary headers to the HEAD response in pkg.pr.new so we can detect whether a package has preview releases. if a package turns to have them, we render that "preview releases" button at the bottom of the "versions" section, as shown in the below screenshot.