⚠️ Deprecated Package

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.

Configuration: Workspace Pattern Configs

You can use the root config to set workspace configs in bulk by using workspace patterns.

Entries' configs will be merged with any existing workspaces' local configs, and each subsequent entry's config will be merged with the accumulated config from any similarly matching previous entries, using the same behavior as mergeWorkspaceConfig.

Since workspace patterns are affected by config, such as using tags, each entry's patterns will match against the accumulated config from the previous entries.

Example Root Config

// bw.root.ts

import { defineRootConfig } from "bun-workspaces/config";

export default defineRootConfig({
  workspacePatternConfigs: [
    { 
      // Any matching workspaces under this path
      // will have their local config merged with this one
      patterns: ["path:libraries/frontend/**/*"],
      config: {
        tags: ["frontend"],
      },
    },
    {
      patterns: ["path:libraries/backend/**/*"],
      config: {
        tags: ["backend"],
      },
    },
    {
      // This tag can be matched thanks to the first entry,
      // merging the accumulated config with this one
      patterns: ["tag:frontend"],
      config: {
        rules: {
          workspaceDependencies: {
            denyPatterns: ["tag:backend"],
          },
        },
      },
    },
    {
      patterns: ["tag:backend"],
      // You can use the raw workspace data and
      // accumulated config for each workspace via callback
      config: (workspace, prevConfig) => ({
        rules: {
          workspaceDependencies: workspace.name.startsWith("@some-scope/")
          ? {
              denyPatterns: ["@some-other-scope/*"],
            }
          : {
              allowPatterns: ["@some-scope/*"],
            }
        },
      }),
    }
  ],
});