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

Allow restricting bun install to specific packages in a workspace #15948

Open
vpontis opened this issue Dec 22, 2024 · 1 comment
Open

Allow restricting bun install to specific packages in a workspace #15948

vpontis opened this issue Dec 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@vpontis
Copy link

vpontis commented Dec 22, 2024

What is the problem this feature would solve?

When we have a workspace project with many different packages, bun requires all packages to be present when running bun install even if we just want to install the dependencies for a single package.

This is relevant for Docker where if we have many packages, we want to copy just the required packages to keep the Docker image size small.

For example, in a monorepo with multiple services, each service might only depend on a subset of shared packages:

  • packages/api depends on packages/shared
  • packages/web depends on packages/ui and packages/shared
  • packages/mobile depends on packages/ui and packages/shared

When building a Docker image for just the API service, we currently have to copy ALL packages (web, mobile, ui, etc.) even though we only need api and shared. This is because the lockfile contains references to all workspace packages.

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

Add ability to scope installation to specific packages, similar to pnpm's --filter flag:

What alternatives have you considered?

  1. Copy entire workspace (inefficient, larger Docker images)
  2. Split into separate repos (loses monorepo benefits)
  3. Dynamically update package.json in the Dockerfile (loses the lockfile benefits and is just generally janky)
@vpontis vpontis added the enhancement New feature or request label Dec 22, 2024
@kravetsone
Copy link

Related - #15735

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