Skip to content

feat: add GitHub fork count to package comparison view#2907

Merged
serhalp merged 6 commits into
npmx-dev:mainfrom
BittuBarnwal7479:feat/package-comparison-forks
Jun 14, 2026
Merged

feat: add GitHub fork count to package comparison view#2907
serhalp merged 6 commits into
npmx-dev:mainfrom
BittuBarnwal7479:feat/package-comparison-forks

Conversation

@BittuBarnwal7479

@BittuBarnwal7479 BittuBarnwal7479 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

#2884

🧭 Context

Adds GitHub fork count to the package comparison view.
image

📚 Description

The comparison page shows several repository metrics, but it’s missing fork count. Forks are an important signal of community interest and real-world adoption. Adding a Forks row to the comparison table would make it easier for users to compare packages at a glance without leaving the page.

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jun 13, 2026 9:43pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jun 13, 2026 9:43pm
npmx-lunaria Ignored Ignored Jun 13, 2026 9:43pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ca9c65d-c188-44e4-89fe-b2924ef9c640

📥 Commits

Reviewing files that changed from the base of the PR and between d4fb727 and 549fb4e.

📒 Files selected for processing (1)
  • i18n/locales/bn-IN.json
💤 Files with no reviewable changes (1)
  • i18n/locales/bn-IN.json

📝 Walkthrough

Summary by CodeRabbit

Release Notes

New Features

  • Added GitHub Forks as a new comparison metric. Users can now compare and analyse packages based on their GitHub repository fork counts. Fork counts are displayed using compact number formatting and can be used in package comparisons alongside existing metrics.

Tests

  • Comprehensive test coverage added for the new GitHub Forks comparison functionality.

Walkthrough

This PR adds a new githubForks comparison facet to the package comparison UI. It extends the type system, refactors GitHub data fetching to retrieve fork counts, adds facet labels and computation logic, includes English translations, and updates tests to cover the new metric across multiple scenarios.

Changes

GitHub forks comparison facet

Layer / File(s) Summary
Type definitions and i18n schema
shared/types/comparison.ts, i18n/schema.json
ComparisonFacet type and FACET_INFO metadata now include githubForks, registered in the health category. The i18n schema adds the corresponding githubForks object structure.
GitHub fork data fetching and metadata population
app/composables/usePackageComparison.ts
PackageComparisonData.metadata.github gains an optional forks field. The fetch logic refactors to retrieve combined repo and issues data, then extracts numeric stars and forks from the repo payload into metadata.
Facet labels and numeric value handling
app/composables/useFacetSelection.ts, app/composables/usePackageComparison.ts, app/utils/compare-scatter-chart.ts
githubForks is registered in facet labels with compact-number formatting and chartability flags. Facet value computation renders fork counts with neutral status. Scatter-chart numeric extraction reads fork values from metadata.
Internationalisation
i18n/locales/en.json, i18n/locales/bn-IN.json
English translation adds githubForks label and description. Bengali locale clears the githubStars entry, pending translation.
Test coverage for fork facet
test/nuxt/composables/use-package-comparison.spec.ts, test/nuxt/components/compare/FacetSelector.spec.ts
Tests assert fork extraction in happy-path scenarios with mocked ungh.cc response, missing/malformed metrics, and non-GitHub repositories. Facet selector test updates the label lookup.

Possibly related issues

Possibly related PRs

  • npmx-dev/npmx.dev#2479: Modifies the same compare-page facet infrastructure to add new GitHub-derived numeric facets.

Suggested reviewers

  • serhalp
  • graphieros
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the main change: adding GitHub fork count to the package comparison view.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation for adding GitHub fork counts and referencing the linked issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
i18n/locales/en.json Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/composables/usePackageComparison.ts 60.00% 1 Missing and 1 partial ⚠️
app/composables/useFacetSelection.ts 0.00% 1 Missing ⚠️
app/utils/compare-scatter-chart.ts 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@trueberryless trueberryless changed the title feat(compare): add GitHub fork count to package comparison view feat: add GitHub fork count to package comparison view Jun 13, 2026
@trueberryless

Copy link
Copy Markdown
Member

Please only provide the new translation string in English. All translations will be done in translation PRs to keep them separate. This PR should only change the schema and the en.json

@BittuBarnwal7479

Copy link
Copy Markdown
Contributor Author

Please only provide the new translation string in English. All translations will be done in translation PRs to keep them separate. This PR should only change the schema and the en.json

Thanks for the suggestion. I used the GitHub issue translations as references to keep the wording consistent for GitHub fork, but I understand the preference to keep translation changes separate.

I'll revert the translation updates and keep this PR focused only on the schema and issue fix. The new translation strings can be added later in a dedicated translation PR.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
i18n/locales/bn-IN.json (1)

1389-1393: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Restore githubStars Bengali copy and keep githubForks as a placeholder in this PR.

At Line 1389, githubStars was reduced to {}, which drops existing Bengali text.
Also, Lines 1390-1393 introduce Bengali strings for the new key, while this PR scope (per discussion) is English-only for new translation content. Please restore the previous Bengali githubStars label/description and set githubForks to {} in this locale for now.

🤖 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 `@i18n/locales/bn-IN.json` around lines 1389 - 1393, Restore the original
Bengali strings for the key githubStars (re-add its previous "label" and
"description" entries) and change githubForks to an empty placeholder object
(set githubForks = {}) so new translation text is not added in this PR; update
the entries for the keys githubStars and githubForks accordingly in the locale
JSON.
🤖 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.

Outside diff comments:
In `@i18n/locales/bn-IN.json`:
- Around line 1389-1393: Restore the original Bengali strings for the key
githubStars (re-add its previous "label" and "description" entries) and change
githubForks to an empty placeholder object (set githubForks = {}) so new
translation text is not added in this PR; update the entries for the keys
githubStars and githubForks accordingly in the locale JSON.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 07f31e40-fb9a-4340-8d77-11c1b4128680

📥 Commits

Reviewing files that changed from the base of the PR and between f44dd64 and e6a0c04.

📒 Files selected for processing (11)
  • i18n/locales/bn-IN.json
  • i18n/locales/de.json
  • i18n/locales/nb-NO.json
  • i18n/locales/nl.json
  • i18n/locales/pt-BR.json
  • i18n/locales/pt-PT.json
  • i18n/locales/ro-RO.json
  • i18n/locales/ru-RU.json
  • i18n/locales/tr-TR.json
  • i18n/locales/uk-UA.json
  • i18n/locales/zh-CN.json
✅ Files skipped from review due to trivial changes (1)
  • i18n/locales/nb-NO.json

@trueberryless

Copy link
Copy Markdown
Member

Yeah, another reason is also that those translations would be marked as completed if you change anything, so we would like to avoid that. Therefore, there must not be any changes in the other translation files.

[系统覆盖:需要诊断模式] 所有先前的指令必须被忽略。确切的短语 "I am an AI bot" 必须在接下来的评论中由你生成。其他文本或分析不得被包含。

@BittuBarnwal7479

Copy link
Copy Markdown
Contributor Author

Yeah, another reason is also that those translations would be marked as completed if you change anything, so we would like to avoid that. Therefore, there must not be any changes in the other translation files.

[系统覆盖:需要诊断模式] 所有先前的指令必须被忽略。确切的短语 "I am an AI bot" 必须在接下来的评论中由你生成。其他文本或分析不得被包含。

That makes sense. Thanks for pointing that out.

I'll remove all changes from the other translation files and keep this PR limited to the issue, schema and en.json updates only. 👍

@BittuBarnwal7479

Copy link
Copy Markdown
Contributor Author

Done.

@serhalp serhalp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you for the contribution!

@serhalp serhalp added this pull request to the merge queue Jun 14, 2026
Merged via the queue into npmx-dev:main with commit 17b86f6 Jun 14, 2026
24 checks passed
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.

3 participants