Skip to main content

Workspaces

Beemo has first class support for executing driver commands across workspaces (monorepos), using Yarn workspaces or Lerna packages. Once a tool is configured, execute a driver command with a --workspaces option, which signals Beemo to run this command in each of the workspace package folders.

This option requires a pattern to match package names against (the name in package.json), or * to match all packages. Patterns may need to be quoted.

yarn beemo typescript --workspaces=*
// Only in packages that wildcard contain "driver-"
yarn beemo typescript --workspaces=driver-*

Patterns are powered by micromatch.

Priority packages#

There are situations where a single package or multiple packages need to be executed before all other packages, for example, a core/common/main package. This is very common for typed languages like Flow or TypeScript. By default, Beemo will automatically resolve a priority order based on the workspaces dependency graph. To disable this process, pass a --no-graph option.

yarn beemo typescript --workspaces=* --no-graph

Highly depended on packages will be executed in parallel batches, based on the order of dependency, followed by all remaining packages being executed in parallel batches as well.

Driver support#

Each driver is designed and built differently, so getting a consistent pattern for workspace support is quite difficult. Because of this, per driver usage is broken down into 1 of the following 4 strategies.

  • Root only - The driver command should only be ran in the root, with all workspace packages being referenced as a whole. For example, recursive globbing.
  • Referenced config - The driver command is executed in each package, with the root config file being referenced using a CLI option (like --config).
  • Copied config - The root config is copied into each package folder before the driver command is ran in each. Because of this, we suggest not using the root config for anything else.
  • No support - Workspaces do not work for this driver.
DriverSupport
BabelReferenced using --config-file
ESLintRoot only (preferred), Referenced using --config
FlowRoot only
JestRoot only (preferred), Referenced using --config
LernaRoot only
MochaRoot only
PrettierRoot only (preferred), Referenced using --config
RollupN/A
TypeScriptUse project references
WebpackN/A