-
Notifications
You must be signed in to change notification settings - Fork 75
feat: use packageManager from package.json as default bun version #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com>
Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com>
Co-authored-by: xhyrom <56601352+xhyrom@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the setup-bun action to automatically detect the Bun version from package.json when no explicit version is provided. The action now follows a priority chain: bun-version input → bun-version-file input → package.json packageManager field → package.json engines.bun field → latest. This makes the action more convenient to use while maintaining full backward compatibility.
Key Changes:
- Added automatic version detection from
package.jsonas a fallback when no explicit version inputs are provided - Introduced a
silentparameter toreadVersionFromFile()to suppress warnings during automatic version detection - Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Added automatic fallback to read Bun version from package.json with silent mode enabled |
| src/utils.ts | Enhanced readVersionFromFile function with optional silent parameter to suppress warnings during automatic checks |
| tests/utils.spec.ts | Added comprehensive test suite covering package.json version reading, silent mode behavior, and existing file format support |
| README.md | Updated documentation to reflect new default behavior and version resolution priority chain |
| package-lock.json | Version bump to 2.1.0 and compare-versions dependency entry (already used in codebase) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When no
bun-versionorbun-version-fileinput is provided, the action now automatically reads the bun version frompackage.json, falling back tolatestif not found.Changes
bun-versioninput →bun-version-fileinput →package.jsonpackageManagerfield →package.jsonengines.bunfield →latestsilentparameter toreadVersionFromFile()to suppress warnings when automatically checkingpackage.jsonExample
With
package.json:{ "packageManager": "bun@1.0.25" }The action will now install Bun 1.0.25 without requiring explicit configuration.
Original prompt
packageManagerfrom package.json as default bun version #108💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.