oven-sh / bun

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

Support `bun run --filter` #5793

Closed long-woo closed 4 days ago

long-woo commented 11 months ago

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

DanielHoffmann commented 11 months ago

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 commented 11 months ago

Related to #5207

We can support both.

FlatMapIO commented 8 months ago

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

angelhdzmultimedia commented 7 months ago

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 commented 5 months ago

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 commented 4 months ago

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 commented 4 months ago

Reproduce this as follows:

Result:

image
ennioVisco commented 4 months ago

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

geongeorge commented 3 months ago

Anybody else get this?

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

> bun --filter '*' build   
error: Script not found "*"
Jokcy commented 3 months ago

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

jocades commented 3 months ago

Anybody else get this?

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

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

Make sure you are using the latest Bun version v1.1.10. I was on v1.0.36 and had the same issue. $ bun upgrade

Jarred-Sumner commented 4 days ago

Support for bun run --filter was added in Bun v1.1.10. The current version of Bun is Bun v1.1.26.

If you run into issues with bun run --filter, please file an issue and we will fix it