website/docs/recipes/using-pnpm-with-lerna.md
Lerna can be used in a pnpm workspace to get the full benefits of both pnpm and Lerna.
When used in a pnpm workspace, Lerna will:
pnpm-workspace.yaml (https://pnpm.io/workspaces)"workspaces" in package.jsonbootstrap, link, and add commands. Instead, you should use pnpm commands directly to manage dependencies (https://pnpm.io/cli/install).lerna version, dependencies will be updated as normal, but will preserve the workspace: prefix if it exists.lerna version will not bump the version of the dependency, since aliases don't specify a version number to bump.To set up pnpm with Lerna:
If not installed already, install pnpm: https://pnpm.io/installation.
Remove the node_modules/ folder in the root, if it exists. If not already using workspaces, run lerna clean to remove the node_modules/ folder in all packages.
Set "npmClient": "pnpm" in lerna.json.
Create a pnpm-workspace.yaml file in the root of your project.
If you are already using npm or yarn workspaces, move the "workspaces" property from package.json to pnpm-workspace.yaml. If you were not already using workspaces, move the "packages" property from lerna.json to pnpm-workspace.yaml. For example:
{
"workspaces": ["packages/*"]
}
and
{
"packages": ["packages/*"]
}
become:
packages:
- "packages/*"
(optional) Run pnpm import to generate a pnpm-lock.yaml file from an existing lockfile. See https://pnpm.io/cli/import for supported lockfile sources.
Run pnpm install.