#Bun run workspace script

1 messages · Page 1 of 1 (latest)

gusty marlin
#

Hey everyone,
Loving Bun so far and tried it in a few. small projects and worked flawlessly.
I now wanted to try it in a bigger one, a monorepo built with yarn workspaces feature.

We have the basic root package.json as follow:

  ...
  "private": true,
  "workspaces": [
    "packages/*"
  ],
  ...
}```.
Then two packages `a`, an UI library, and `b` the main app, and consumer.
In their respective `package.json` they have a `name` property as follow: `@organization/<package>`.

With `yarn`, when running `yarn run dev` on the app, it would execute the following:
`"dev": "yarn prebuild && webpack serve",`
the `prebuild` command is where I run into an issue. It would do the following:
`"prebuild": "yarn workspace @organization/a build",`.
I tried combinations with `bun run`, `bunx` and such, and couldn't translate it properly and make it work.

How should I proceed?

Thanks ❤️
serene bone
#

Also curious about this.

hybrid sandal
#

Bun doesn't yet support this. You might be able to use something like lerna in the meantime, though I haven't tried it myself.

Our plan is to implement npm's API here: --workspace and --workspaces

daring merlin
#

Would also love to see this. I do think the pnpm --filter is a better starting point than Yarn though.

For now, I'm just planning on creating some Bun/Node scripts to loop through the workspaces to run X command until this gets shipped.

neat lagoon
#

I was searching for a lerna issue and found this message, in our monorepo we fix some of those issues by using turbo. If you just need to execute a certain script in an specific package you can also cd packages/example && bun run desiredScript