Workspace patterns are used to match workspaces when running commands such as run-script or list-workspaces.
By default, workspace patterns match the workspace name or alias, but if a wildcard is provided, it will only match the name.
bw run lint my-name-or-alias "my-name-pattern-*"
However, you can use the following matching specifiers to match workspaces by different criteria:
Match by the workspace name (from package.json). Accepts wildcards.
bw ls name:my-workspace "name:my-workspace-*"
bw run lint "name:my-workspace-*"Match by the workspace alias. Accepts wildcards.
bw ls "alias:my-alias-*"
bw run lint "alias:my-alias-b"Match by the relative workspace path, with glob syntax supported.
bw ls "path:packages/**/*"
bw run lint "path:packages/**/*"These same matching patterns can be used in the API.
import { createFileSystemProject } from "bun-workspaces";
const project = createFileSystemProject();
project.findWorkspacesByPattern(
"name:my-workspace-*",
"alias:my-alias-*",
"path:packages/**/*"
);
project.runScriptAcrossWorkspaces({
workspacePatterns: [
"name:my-workspace-*",
"alias:my-alias-*",
"path:packages/**/*",
],
script: "bun lint",
});