oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.98k stars 2.66k forks source link

Bunx: support specifying package to install #7034

Open davidlj95 opened 10 months ago

davidlj95 commented 10 months ago

What is the problem this feature would solve?

If the binary to run is not named same as the package, you won't be able to run it with bunx. There are some binaries included in packages that don't have same name as package.

For instance, Renovate: a tool to update dependencies. Their package provides two binaries:

  1. renovate (same as package name) to run the dependencies update bot
  2. renovate-config-validator: to validate your config

You can run the bot with bunx renovate. But you can't run the renovate-config-validator using bunx right now.

Other package managers offer the -p CLI option to specify which package to install, then the first argument is the binary to run. For instance, following previous example:

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

Would be nice to have also some -p or --package to enable this use case :)

What alternatives have you considered?

Installing the dependency, then use bun run with path to script in node_modules directory. But the great of bunx is to just install and run for dependencies that won't be needed often. Like validating the configuration of your dependencies update tool.

Until then, other package managers can be used for this purpose

telekid commented 9 months ago

I'll take a look at this when I have a bit.