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

Support bun run --filter #5793

Open
long-woo opened this issue Sep 20, 2023 · 10 comments
Open

Support bun run --filter #5793

long-woo opened this issue Sep 20, 2023 · 10 comments
Labels
enhancement New feature or request npm Something that relates to the npm-compatible client

Comments

@long-woo
Copy link

What is the problem this feature would solve?

This is a cool project, I’m about to try it out in my project, thanks!

I hope to support --filter similar to pnpm, which is quite practical in workspace type projects.

https://pnpm.io/filtering

image

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

Select the package through it, such as:

# File path
bun add vue --filter ./apps/web

# The name value of the package.json file
bun add vue --filter @dev/web

What alternatives have you considered?

No response

@long-woo long-woo added the enhancement New feature or request label Sep 20, 2023
@DanielHoffmann
Copy link

This feature is really nice if you have a big monorepo with lots of separate projects, installing only a subset of dependencies can help with making builds faster and artifacts smaller

@Electroid Electroid added the npm Something that relates to the npm-compatible client label Sep 20, 2023
@Electroid
Copy link
Contributor

Related to #5207

We can support both.

@Electroid Electroid changed the title Support --filter Support bun run --filter Sep 20, 2023
@FlatMapIO
Copy link

If you don't have a need to wildcard package names, you can first use bun run --cwd packages/abc build

@angelhdzmultimedia
Copy link

If you don't have a need to wildcard package names, you can first use bun run --cwd packages/abc build

Life saver thanks! 🔥🐰🍞☺️🤝

@annminn104
Copy link

If you don't have a need to wildcard package names, you can first use bun run --cwd packages/abc build

Thanks!
I also encountered the same error if I needed to run multiple packages at once
and this is how I modified it

example with yarn: yarn run build --filter=packages/**

with bun: bun run --cwd packages build

@magiconair
Copy link

I have three http servers in separate subdirectories and when I want to run the dev script (bun run index.ts) on all of them with bun --filter './src/*' dev it hangs as follows. Any idea what is wrong here?

image

@magiconair
Copy link

Reproduce this as follows:

  • create a test/a/index.ts with the simple web server from https://bun.sh/guides/http/simple
  • create a test/b/index.ts with the simple web server from https://bun.sh/guides/http/simple and change the port to 3001
  • create a test/a/package.json with {"scripts":{"dev":"bun run index.ts"}}
  • create a test/b/package.json with {"scripts":{"dev":"bun run index.ts"}}
  • run cd test && bun --filter './*' dev

Result:
image

@ennioVisco
Copy link

it would be cool to have this also for the install command, like in pnpm

@geongeorge
Copy link

geongeorge commented May 11, 2024

Anybody else get this?

> bun --filter './app/*' dev    
error: Module not found "./app/*"


> bun --filter '*' build   
error: Script not found "*"

@Jokcy
Copy link

Jokcy commented May 16, 2024

Anybody else get this?

> bun --filter './app/*' dev    
error: Module not found "./app/*"


> bun --filter '*' build   
error: Script not found "*"

Same here, always got Script not found error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request npm Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

10 participants