I am currently migrating our project from Lerna to PNPM and we have a script we run I have posted it below
"postinstall": "npm run bootstrap"
"bootstrap": "lerna bootstrap --hoist",
"clean": "lerna clean -y",
is there a PNPM equivalent of Lerna bootstrap command and Lerna clean command?
You don't need any Lerna bootstrap equivalent, just get started with pnpm workspace is easy enough, you just need to add a
pnpm-workspace.yaml
file in your project root and add the location of your packages (which is typicallypackages/
). As mentioned on pnpm documentation:Hoisting is not recommended with pnpm and is disabled by default, but if you really want to hoist then you can add
shamefully-hoist
into.npmrc
, see pnpm doc - shamefully-hoistI'm not sure about
lerna clean
equivalent but to remove a dependency from node module, you can usepnpm remove --recursive
as per pnpm doc - removeYou can see an example of all of that in Lerna-Lite pnpm-workspace.yaml and I would suggest you to take a look at Lerna-Lite and maybe not give up Lerna entirely, I created Lerna-Lite fork when Lerna was no longer maintained (it is now) and the big difference is that Lerna-Lite only has a subset of the original Lerna commands (all the Lerna commands you mentioned aren't in Lerna-Lite because all package managers now handle these better than Lerna/Lerna-Lite does), the other distinction is that it's much smaller since I also made a few commands as optional packages and only kept
version
andpublish
in the core CLI, so it's much smaller whenversion
andpublish
is all you need. I also don't like the new Lerna changes and the new direction that Lerna is now heading to (it's becoming more & more another Nrwl/Nx product, because Lerna v6 is now requiring Nx behind the scene, and that is not the case with Lerna-Lite, Nx can be installed with Lerna-Lite but it's totally optional and that's the way it should and will always be in Lerna-Lite).