Starting without the need for a Lerna bootstrap equivalent, simply dive into pnpm workspace which is quite straightforward. All you have to do is include a pnpm-workspace.yaml
file in your project's root directory and specify the location of your packages (usually packages/
). As stated in the pnpm documentation:
A workspace must contain a pnpm-workspace.yaml
file in its main directory. Additionally, a workspace can also have an .npmrc
file in its root.
Hoisting is not recommended with pnpm by default, but if hoisting is desired, you can include shamefully-hoist
in the .npmrc
file as explained in the pnpm doc - shamefully-hoist
By default, pnpm generates a strict layout of node_modules
, allowing dependencies access to undeclared dependencies while restricting modules outside of node_modules
. This setup works seamlessly with most packages in the ecosystem. But, if certain tools require hoisted dependencies at the root level of node_modules
, setting this option to true
will handle the hoisting automatically.
I'm unsure about an exact equivalent of lerna clean
, but to eliminate a dependency from the node module, you can utilize pnpm remove --recursive
according to the pnpm doc - remove
When used within a workspace (with --recursive
), removes a dependency (or dependencies) from every package within the workspace.
When used outside of a workspace, removes a dependency (or dependencies) from all packages located in subdirectories.
You can observe an illustration of these practices in Lerna-Lite's pnpm-workspace.yaml and it may be beneficial to explore Lerna-Lite without completely abandoning Lerna. I developed a Lerna-Lite fork when Lerna ceased to receive maintenance updates (although it does now). The key differences lie in Lerna-Lite featuring only a subset of the original Lerna commands (omitting commands handled more efficiently by other package managers), alongside being significantly smaller due to some commands being offered as optional packages, retaining only version
and publish
in the core CLI. Personally, I disagree with the recent changes in Lerna's direction wherein it reflects similarities to Nrwl/Nx products; whereas Lerna-Lite remains devoid of such influences. Nx remains installable with Lerna-Lite but is entirely optional, maintaining the essence and focus on simplicity inherent to Lerna-Lite).