Skip to content
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

Improve package manager detection for Bun 1.2 compatibility #165

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

r3cha
Copy link

@r3cha r3cha commented Jan 26, 2025

I'm using bun and install packages with bun install --yarn and its generate a yarn.lock file, same time new version of bun 1.2 generates bun.lock file instead of bun.lockb.
Some users may have bun with yarn.lock file or bun with bun.lock

My assets recompilation failed with:

RAILS_ENV=production rails assets:precompile
bin/rails aborted!
cssbundling-rails: Command install failed, ensure yarn is installed

Tasks: TOP => assets:precompile => css:build => css:install
(See full trace by running task with --trace)

Here is a proposal to handle this, idk what best way to do this. If this way looks ok I can fix test as well. Also we have using_bun? method at Helpers module that dose not check for bun.lock and return false if bun exists and yarn.lock present

  • Add support for both old bun.lockb and new bun.lock Bun lock files
  • Handle Bun with Yarn compatibility mode yarn.lock
  • Combine command existence and lock file checks into single method

r3cha added 2 commits January 26, 2025 10:27
- Add support for both old (bun.lockb) and new (bun.lock) Bun lock files
- Handle Bun with Yarn compatibility mode (yarn.lock)
- Simplify tool detection by introducing LOCK_FILES mapping
- Combine command existence and lock file checks into single method

This change ensures proper detection of Bun when using different versions
or when running in Yarn compatibility mode (bun install --yarn).
@r3cha r3cha marked this pull request as ready for review January 26, 2025 10:45
@r3cha r3cha mentioned this pull request Jan 26, 2025
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.

1 participant