Skip to content

Support for running monorepo package.json scripts by unique name or qualified name #19193

@csyrs

Description

@csyrs

What is the problem this feature would solve?

When working from the root of a monorepo, it's awkward to run a single package.json script. There are two existing means of doing so:

  • cd-ing into the desired package, using bun run <script-name>, then cd-ing back
  • Using bun run --filter <package-name> <script-name>

These are relatively simple to use, but it still feels like there should be an easier way.

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

bun run --filter is powerful and already established. However, it feels strange to me to use for single scripts. (It's also slightly annoying to type.)

One way to better support the single-script use case would be to enable bun run to automatically run any script in a monorepo that has a unique name. That is, bun run <script-name> would run any script in the workspace matching <script-name> as long as there is only one match.

Another approach could be to allow bun run <package-name> <script-name> directly, assuming this doesn't controvert any existing or potential Bun syntax.

What alternatives have you considered?

Covered in previous sections---although I'm not convinced anything should be done in the first place. It's just a small annoyance I encountered in Bun's already great monorepo support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bun installSomething that relates to the npm-compatible clientenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions