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

Resolve version ranges when using bun add with an alias #11901

Open
jordanbtucker opened this issue Jun 15, 2024 · 0 comments
Open

Resolve version ranges when using bun add with an alias #11901

jordanbtucker opened this issue Jun 15, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@jordanbtucker
Copy link

jordanbtucker commented Jun 15, 2024

What is the problem this feature would solve?

According to Install a package under a different name with Bun it's possible to add a dependency like this:

bun add format@npm:prettier

This results in a the following dependency being added to package.json as well as a format directory being added to node_modules containing the prettier package.

"format": "npm:prettier",

Compare this to how npm handles aliases.

npm install format@npm:prettier
// package.json
"format": "npm:prettier@^3.3.2",

Note that npm resolves the latest version and adds a caret range. Bun does not do this, so you'd need to do that manually:

bun add format@npm:prettier@^3.3.2

What is the feature you are proposing to solve the problem?

bun add should resolve the latest version of a package when using an alias. This would stay consistent with how npm installs aliased packages as well as how npm install and bun add work in general.

What alternatives have you considered?

The alternative is to add the version or range yourself, which is tedious and error prone.

bun add format@npm:prettier@^3.3.2
@jordanbtucker jordanbtucker added the enhancement New feature or request label Jun 15, 2024
@dylan-conway dylan-conway self-assigned this Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants