bun icon indicating copy to clipboard operation
bun copied to clipboard

Support `bun run --filter`

Open long-woo opened this issue 11 months ago • 10 comments

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 avatar Sep 20 '23 09:09 long-woo

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

DanielHoffmann avatar Sep 20 '23 11:09 DanielHoffmann

Related to #5207

We can support both.

Electroid avatar Sep 20 '23 16:09 Electroid

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

FlatMapIO avatar Dec 31 '23 05:12 FlatMapIO

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

Life saver thanks! 🔥🐰🍞☺️🤝

angelhdzmultimedia avatar Jan 18 '24 20:01 angelhdzmultimedia

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

annminn104 avatar Apr 02 '24 04:04 annminn104

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 avatar Apr 19 '24 13:04 magiconair

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

magiconair avatar Apr 19 '24 17:04 magiconair

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

ennioVisco avatar May 06 '24 22:05 ennioVisco

Anybody else get this?

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


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

geongeorge avatar May 11 '24 08:05 geongeorge