Skip to content

feat(cli): add Bun support for publishing packages#1789

Open
shtse8 wants to merge 5 commits intochangesets:mainfrom
shtse8:feat/bun-publish-support
Open

feat(cli): add Bun support for publishing packages#1789
shtse8 wants to merge 5 commits intochangesets:mainfrom
shtse8:feat/bun-publish-support

Conversation

@shtse8
Copy link

@shtse8 shtse8 commented Nov 26, 2025

Summary

  • Add Bun detection in getPublishTool using package-manager-detector
  • Use bun publish command when Bun is detected as the package manager
  • Add tests for npm-utils including registry configuration and PM detection

Details

When a project uses Bun as its package manager (detected via bun.lockb or packageManager field in package.json), changesets will now use bun publish instead of npm publish.

Bun automatically resolves workspace:*, workspace:^, and workspace:~ references to actual version numbers during publish, so no additional changes are needed for workspace protocol handling.

Test plan

  • Added unit tests for getCorrectRegistry function
  • Added unit tests for package manager detection (bun, pnpm, yarn, npm)
  • All existing publish tests pass
  • TypeScript compilation passes
  • Build succeeds

Related issues

Closes #1080 (Bun support request)

- Add Bun detection in getPublishTool using package-manager-detector
- Use `bun publish` command when Bun is detected as the package manager
- Add tests for npm-utils including registry configuration and PM detection

Bun automatically resolves workspace:* references during publish, so no
additional changes are needed for workspace protocol handling.
@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

🦋 Changeset detected

Latest commit: 2555ffb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.13%. Comparing base (3fdcb18) to head (2555ffb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1789      +/-   ##
==========================================
+ Coverage   81.10%   83.13%   +2.03%     
==========================================
  Files          54       54              
  Lines        2265     2271       +6     
  Branches      683      683              
==========================================
+ Hits         1837     1888      +51     
+ Misses        423      378      -45     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add comprehensive tests for the publish function that cover:
- Bun detection and bun publish command
- pnpm detection with version check and --no-git-checks flag
- npm detection and fallback behavior
- yarn detection (falls back to npm for publishing)
- Success and failure scenarios
@mrginglymus
Copy link
Contributor

More support is always better, but it'll sting if this gets in before #674 😛

@shtse8
Copy link
Author

shtse8 commented Nov 26, 2025

More support is always better, but it'll sting if this gets in before #674 😛

Haha yeah, I’ve been reading through #674 as well – that one’s a beast with a ton of history 😅

Totally agree it’d be great to have a more general, “all package managers” solution land.

This PR is meant to be a small, incremental win for Bun users in the meantime, but I’d be very happy to align it with whatever direction #674 (or any successor work) takes. If there’s anything I can tweak here to make that easier, I’m all ears.

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.

2 participants