Skip to content

Add npmx.dev link on file preview failure - #127

Merged
fengmk2 merged 3 commits into
masterfrom
copilot/add-link-to-npmx-dev
Feb 26, 2026
Merged

Add npmx.dev link on file preview failure#127
fengmk2 merged 3 commits into
masterfrom
copilot/add-link-to-npmx-dev

Conversation

Copilot AI commented Feb 26, 2026

Copy link
Copy Markdown
Contributor
  • Add a link to npmx.dev code page in the "产物预览失败" error result component
  • Add unit tests for the files viewer component covering:
    • Error state: displays npmx.dev link with correct URL
    • Error state: uses "latest" as spec when version is not provided
    • Error state: constructs correct link for scoped packages
    • Loading state: displays spinner
    • Success state: displays file tree and code viewer
    • Success state: does not display npmx.dev link
Original prompt

This section details on the original issue you should resolve

<issue_title>在「产物预览失败」的时候,增加一个链接跳到对应的 npmx.dev code 页面</issue_title>
<issue_description>https://npmmirror.com/package/vibe-kanban/files?version=0.1.19

Image

https://npmx.dev/package-code/vibe-kanban/v/0.1.19</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Feb 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cnpmweb Ready Ready Preview, Comment Feb 26, 2026 2:27pm

Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 26, 2026

Copy link
Copy Markdown

Deploying cnpmweb with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2271c62
Status: ✅  Deploy successful!
Preview URL: https://704d8754.cnpmweb.pages.dev
Branch Preview URL: https://copilot-add-link-to-npmx-dev.cnpmweb.pages.dev

View logs

Copilot AI changed the title [WIP] Add link to npmx.dev code page for product preview failure Add npmx.dev link on file preview failure Feb 26, 2026
@fengmk2

fengmk2 commented Feb 26, 2026

Copy link
Copy Markdown
Member

@copilot add unittest for this change

@fengmk2
fengmk2 marked this pull request as ready for review February 26, 2026 14:24
Copilot AI review requested due to automatic review settings February 26, 2026 14:24
Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>

Copilot AI commented Feb 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot add unittest for this change

Added unit tests in 2271c62. The test file covers error state (npmx.dev link with correct URL, "latest" fallback, scoped packages), loading state, and success state. All 41 tests pass (35 existing + 6 new).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a fallback path for users to view package source code when the file preview (“产物预览失败”) fails, by surfacing a link to the corresponding npmx.dev “package-code” page.

Changes:

  • Extends the antd Result shown on preview failure to include an extra action.
  • Adds an external link pointing to https://npmx.dev/package-code/{name}/v/{version}.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/slugs/files/index.tsx
@fengmk2
fengmk2 merged commit e03221f into master Feb 26, 2026
11 checks passed
@fengmk2
fengmk2 deleted the copilot/add-link-to-npmx-dev branch February 26, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

在「产物预览失败」的时候,增加一个链接跳到对应的 npmx.dev code 页面

3 participants