bun-workspaces has been deprecated and is now developed as pacwich, which supports Bun, npm, and pnpm workspaces, with a mostly backwards compatible CLI and API. Users can expect little to no disruption beyond the package name change and config file name changes.
A full migration guide covering all differences between the packages is available at https://pacwich.dev/intro/bun-workspaces-migration
Installation docs are available at https://pacwich.dev/intro/getting-started
You can also instruct an LLM agent to read https://pacwich.dev/intro/bun-workspaces-migration/index.md to assist with migration.
Read the launch blog post about the motivations and development strategy.
bun-workspaces will not receive further releases save for critical security patches, if necessary. This website will stay up at least through 2026. Once decommissioned, documentation will be consolidated to the package README.
Normally, a "script" in bun-workspaces references one of the entries found in a workspace's "scripts" field in its package.json file.
However, it's possible to run a one-off shell command from a workspace's directory, an "inline script", such as via bw run "echo 'hello'" --inline in the CLI.
Normally, inline scripts are executed using the Bun shell, a bash-like, cross-platform shell, the same as the utility import { $ } from 'bun'.
You can pass --shell=system to use the native shell instead. In POSIX systems (Linux, macOS, etc.), sh -c is called, while in Windows, cmd /d /s /c is called.
You can also set the root config.defaults.shell or environment variable BW_SHELL_DEFAULT to "system" to use the native shell by default.
# This will use the Bun shell,
# unless the root config.defaults.shell
# or process.env.BW_SHELL_DEFAULT is set to "system"
bw run "echo 'hello'" --inline
# Same as the above command
bw run "echo 'hello'" --inline --shell=default
# Explicitly run the Bun shell
bw run "echo 'hello'" --inline --shell=bun
# Run an inline command from the workspace directory using the native shell
bw run "echo 'hello'" --inline --shell=system
import { createFileSystemProject } from "bun-workspaces";
const project = createFileSystemProject();
// This will use the Bun shell,
// unless the rootconfig.defaults.shell
// or process.env.BW_SHELL_DEFAULT is set to "system"
project.runWorkspaceScript({
workspaceNameOrAlias: "my-workspace",
script: "echo 'this is my inline script'",
inline: true,
});
project.runWorkspaceScript({
workspaceNameOrAlias: "my-workspace",
script: "echo 'this is my inline script'",
// Takes "bun", "system", or "default", same as the CLI --shell option
inline: { shell: "system" },
});
Scripts from package.json are named by the key in the "scripts" field.
This is used in output logs and workspace script metadata.
Inline scripts, however, have no name by default, but you can provide a name.
# Pass a name for an inline script
bw run "echo 'my script: <scriptName>'" --inline --inline-name=my-inline-script
project.runWorkspaceScript({
workspaceNameOrAlias: "my-workspace",
script: "echo 'this is my inline script'",
// The name will be empty by default
inline: true,
});
// Pass a name for an inline script
project.runWorkspaceScript({
workspaceNameOrAlias: "my-workspace",
script: "echo 'my script: <scriptName>'",
inline: { scriptName: "my-inline-script" },
});