Skip to content

feat: show a warning when significant size increase#1673

Merged
danielroe merged 7 commits intomainfrom
jg/we-have-to-go-bigger
Feb 26, 2026
Merged

feat: show a warning when significant size increase#1673
danielroe merged 7 commits intomainfrom
jg/we-have-to-go-bigger

Conversation

@43081j
Copy link
Contributor

@43081j 43081j commented Feb 26, 2026

When viewing a package, this shows a warning box making the user aware
that the number of dependencies or the install size significantly
increased.

It sets the thresholds as:

  • Significant size increase = 25%
  • Significant dependency count increase = >5

🔗 Linked issue

N/A

When viewing a package, this shows a warning box making the user aware
that the number of dependencies or the install size significantly
increased.

It sets the thresholds as:

- Significant size increase = 25%
- Significant dependency count increase = >5
@vercel
Copy link

vercel bot commented Feb 26, 2026

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

Project Deployment Actions Updated (UTC)
docs.npmx.dev Ready Ready Preview, Comment Feb 26, 2026 10:20pm
npmx.dev Ready Ready Preview, Comment Feb 26, 2026 10:20pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Feb 26, 2026 10:20pm

Request Review

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

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
lunaria/files/en-GB.json Localization changed, will be marked as complete. 🔄️
lunaria/files/en-US.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
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new Vue 3 component SizeIncrease to display install-size and dependency-count diffs; introduces the useInstallSizeDiff composable that chooses a comparison version, lazily fetches prior install-size data, computes an InstallSizeDiff and exposes diff, comparisonVersion and comparisonStatus; adds shared install-size types and re-exports them; removes duplicate interfaces from server utils; integrates the composable and component into the package page; adds i18n keys and schema entries for size increase messages; and adds unit and a11y tests for the composable and component.

Possibly related PRs

Suggested labels

front, a11y

Suggested reviewers

  • danielroe
  • alexdln
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly describes the feature being added: a warning box showing when install size or dependency count significantly increased, with defined thresholds.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jg/we-have-to-go-bigger

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
test/nuxt/composables/use-install-size-diff.spec.ts (1)

99-194: Add explicit boundary tests for threshold cut-offs.

Please add exact-boundary assertions for 25% size increase and +5 dependencies to lock in the intended > semantics.

🧪 Suggested test additions
+    it('does not exceed size threshold at exactly 25%', async () => {
+      const pkg = createPackage({ '1.0.0': '2020-01-01', '1.1.0': '2021-01-01' })
+      const current = createInstallSize({ version: '1.1.0', totalSize: 6250, dependencyCount: 3 })
+      fetchSpy.mockResolvedValue(
+        createInstallSize({ version: '1.0.0', totalSize: 5000, dependencyCount: 3 }),
+      )
+
+      const { diff } = useInstallSizeDiff('pkg-size-boundary', '1.1.0', pkg, current)
+      await vi.waitFor(() => expect(fetchSpy).toHaveBeenCalled())
+      expect(diff.value).toBeNull()
+    })
+
+    it('does not exceed dependency threshold at exactly +5 dependencies', async () => {
+      const pkg = createPackage({ '1.0.0': '2020-01-01', '1.1.0': '2021-01-01' })
+      const current = createInstallSize({ version: '1.1.0', totalSize: 5000, dependencyCount: 8 })
+      fetchSpy.mockResolvedValue(
+        createInstallSize({ version: '1.0.0', totalSize: 5000, dependencyCount: 3 }),
+      )
+
+      const { diff } = useInstallSizeDiff('pkg-dep-boundary', '1.1.0', pkg, current)
+      await vi.waitFor(() => expect(fetchSpy).toHaveBeenCalled())
+      expect(diff.value).toBeNull()
+    })

As per coding guidelines "**/*.{test,spec}.{ts,tsx}: Write unit tests for core functionality using vitest."


ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf4b537 and e7e612d.

📒 Files selected for processing (11)
  • app/components/Package/SizeIncrease.vue
  • app/composables/useInstallSizeDiff.ts
  • app/pages/package/[[org]]/[name].vue
  • i18n/locales/en.json
  • i18n/schema.json
  • lunaria/files/en-GB.json
  • lunaria/files/en-US.json
  • server/utils/install-size.ts
  • shared/types/index.ts
  • shared/types/install-size.ts
  • test/nuxt/composables/use-install-size-diff.spec.ts
💤 Files with no reviewable changes (1)
  • server/utils/install-size.ts

@trueberryless
Copy link
Contributor

Awesome, love this feature. Do you have a link to an example package where this can be seen in action?

@danielroe
Copy link
Member

I suspect https://npmx-a1vxjhmu7-npmx.vercel.app/package/resolve/v/2.0.0-next.6 ...

Copy link
Contributor

@trueberryless trueberryless left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Awesome new test cases as well, thank you!

@danielroe danielroe added this pull request to the merge queue Feb 26, 2026
Merged via the queue into main with commit a38a2f7 Feb 26, 2026
20 checks passed
@danielroe danielroe deleted the jg/we-have-to-go-bigger branch February 26, 2026 22:34
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