Commonality will automatically infer the directories in which to search for packages based on your package manager’s workspaces configuration.

Commonality supports all glob expressions that are supported by micromatch.

Automatic configuration

npm, yarn, and bun

For these package managers, Commonality will read the workspaces property in the package.json at the root of your project.

package.json
{
  "workspaces": ["apps/*", "packages/**", "!**/dist/**"]
}

pnpm

For pnpm, Commonality will read the packages property in the pnpm-workspace.yaml file at the root of your project.

pnpm-workspace.yaml
packages:
  - 'apps/*'
  - 'packages/**'
  - '!**/dist/**'

Manual configuration

Workspaces can also be set manually in the project configuration file.

This property can be helpful in integrated monorepos where setting workspaces in your package manager’s configuration would cause unintended side-effects.

Setting this property will override the workspaces inferred from your package manager.

.commonality/config.json
{
  "workspaces": ["apps/*", "packages/**", "!**/dist/**"]
}