fix: dependencies complex version link#1524
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change adds a VersionLink interface, a LAST_VERSION_IN_RANGE_REGEXP constant, and a buildVersionLink(version: string) function in app/utils/versions.ts that converts complex semver strings into { href, title } objects. app/components/Package/Dependencies.vue was updated to convert dependency version strings (dependencies, peerDependencies, optionalDependencies) into objects via buildVersionLink, adjust sorting and v-for usage to the new { name, version } shape, and use version.href/version.title for links, routes and tooltips across vulnerability, deprecation and optional dependency renderings. Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
55396f2 to
541e7d9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/utils/versions.ts (1)
230-241: Optional: union whose last segment is a comparator set produces a non-exacthref.When the last
||segment itself contains comparator operators (e.g.1.0.0 || >=2.0.0 <3.0.0), the first branch returnshref = '>=2.0.0 <3.0.0', which is still not a valid single-version URL. ApplyingLAST_VERSION_IN_RANGE_REGEXPto the last segment as well would cover this case.♻️ Proposed approach
if (version.includes('||') && !version.includes(' - ')) { const versions: string[] = version.split('||').map(item => item.trim()) - href = versions.at(-1) || version + const lastSegment = versions.at(-1) || version + // If the last segment itself is a comparator, extract its trailing version + href = />=|<=|[<>]|&&/.test(lastSegment) + ? lastSegment.match(LAST_VERSION_IN_RANGE_REGEXP)?.[1]?.replace(/\s+/g, '') || lastSegment + : lastSegment
…x-key/npmx.dev into fix-deps-version-union-links
…deps-version-union-links
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Scott Wu <sw@scottwu.ca> Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Vordgi <sasha2822222@gmail.com>
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
@wojtekmaj looks like a failed merge |
@danielroe I had nothing to do with this :D It just shows my name because my commit is listed there, I guess. |
Resolves #1120
^1.0.0->^1.0.0Simple1.0.0 || 2.0.0->2.0.0Union>1.0.0 <=2.0.0-><=2.0.0Comparator Set1.0.0 - 2.0.0->2.0.0Range1.0.0 - 2.0.0 || 3.0.0 - 4.0.0->4.0.0Union of Rangesdependencies,peerDependenciesandoptionalDependenciescould have complex version (while 99% cases it'speer), so all of them are handled"||"(1.0.0 || 2.0.0), but I think people rarely need to click on a specific version for union, also it would add some incosistency, so I keep it as a one link, which points to the latest version from UnionExamples for reference:
Comparator Set (dependencies): https://npmx.dev/package/sass
Comparator Set (peer): https://npmx.dev/package/styled-components/v/3.5.0-0
Union (dependencies): https://npmx.dev/package/normalize-package-data/v/2.5.0, https://npmx.dev/package/loose-envify/v/1.4.0
Union (peer): https://npmx.dev/package/eslint-plugin-react