I am using Lerna to manage multiple packages and I would like to support multiple versions of such packages.
I need to start a new version 3 (breaking changes) in the packages while providing continuous support for the previous version 2.
How do I maintain multiple concurrent versions of multiple packages in Lerna?
Many thanks.
By itself Lerna isn't designed to manage different versions of your packages. You need to publish your packages in order to achieve what I believe is your desired effect. Once you have old versions of your package(s) published, Lerna makes it very easy to switch between them.
When you run lerna bootstrap, Lerna will first try to satisfy any dependencies while looking through your workspaces. However, if it does not find a package with a matching name AND version it will try to npm install (or yarn add) your package.
This way, you can keep working on your latest 3.x version of the code locally, and when you need to point to the old version for maintenance, just change the required version in your package.json file(s), and when you run bootstrap, Lerna will fetch the appropriate package.