fix: .tool-versions regex - #144
Conversation
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
WalkthroughUpdated the .tool-versions parser in Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
dist/setup/index.jsis excluded by!**/dist/**
📒 Files selected for processing (1)
src/utils.ts(1 hunks)
|
@xhyrom |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
dist/setup/index.jsis excluded by!**/dist/**
📒 Files selected for processing (1)
src/utils.ts(1 hunks)
b08cdef to
a961131
Compare
| file: .tool-versions | ||
| run: echo "bun 1.1.0" > .tool-versions | ||
|
|
||
| - name: .tool-versions (bun1.1.0) |
There was a problem hiding this comment.
this format is not supported on asdf
There was a problem hiding this comment.
we should continue supporting this, even though it’s invalid, until the next major version so we don’t break semver
There was a problem hiding this comment.
Thanks for the feedback. I've updated the regex to use negative lookahead (?![a-zA-Z]) which:
- Excludes
bundlerand similar patterns (the original bug) - Maintains backward compatibility for
bun1.1.0format (no space) - Keeps support for the standard
bun 1.1.0format
This approach preserves semver compatibility as @xhyrom suggested.
| file: .tool-versions | ||
| run: echo "bun 1.1.0" > .tool-versions | ||
|
|
||
| - name: .tool-versions (bun1.1.0) |
There was a problem hiding this comment.
we should continue supporting this, even though it’s invalid, until the next major version so we don’t break semver
… support - Update regex to /^bun(?![a-zA-Z])\s*(?<version>\S+)$/m - Restore test case for .tool-versions (bun1.1.0)
|
thanks! |
|
@ronnnnn can you resolve conflicts please? |
Resolved conflict in dist/setup/index.js by rebuilding the bundle from src/utils.ts which retains the negative lookahead regex (`/^bun(?![a-zA-Z])\\s*(?<version>\\S+)$/m`) to exclude "bundler" entries while still parsing "bun" versions correctly.
|
@xhyrom |
There was a problem hiding this comment.
Pull request overview
This PR aims to fix .tool-versions parsing so the action correctly detects Bun’s version even when other tool entries begin with bun (e.g. bundler).
Changes:
- Update the
.tool-versionsregex used to extract the Bun version. - Update the compiled
dist/setup/index.jsbundle to reflect the source change.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/utils.ts |
Adjusts the .tool-versions version-extraction regex used by readVersionFromFile. |
dist/setup/index.js |
Updates the bundled output so runtime behavior matches src/ changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| ".tool-versions": (content: string) => | ||
| content.match(/^bun\s*(?<version>.*?)$/m)?.groups?.version, | ||
| content.match(/^bun(?![a-zA-Z])\s*(?<version>\S+)$/m)?.groups?.version, |
| }, | ||
| ".tool-versions": (content: string) => | ||
| content.match(/^bun\s*(?<version>.*?)$/m)?.groups?.version, | ||
| content.match(/^bun(?![a-zA-Z])\s*(?<version>\S+)$/m)?.groups?.version, |
Overview
I had a mistake on #94.
We can't find bun's version correctly when
.tool-versionshave other versions begin "bun".Reproduce steps
In
.tool-versions:Regex check
https://regex101.com/r/2aCusB/4