How to Manage Versioning in a Monorepo with Shared Libraries?
Asked by
CuriousCoder92
I have two applications, A and B, that both rely on a shared UI library. If I need to make significant changes to the UI library, how can I version it in such a way that application A uses the new version while application B continues to use the old version? Any advice would be appreciated!
Answers
If you're temporarily migrating and need different versions, you can pin specific versions in each app's package.json instead of using `workspace:*`. This method works as a short-term solution. Just be careful โ that's not a long-term fix. It's best to prioritize updating all apps to the latest version eventually.
Reply to this answer
You should consider using a CLI tool that can check the versions of all your monorepo packages and update them accordingly. This can help with versioning when making major changes. Just remember, consistency is key โ everything should ideally use the same version to avoid complications.
Reply to this answer
In a monorepo, the ideal situation is to keep everything at the same version. If you start wanting different versions for different apps, you might be better off separating them into individual repositories. This way, each can manage its own dependencies without conflict.
Reply to this answer
It's generally recommended to keep all internal packages updated to the latest version in a monorepo. If you change the UI library and it breaks application B, you shouldn't publish anything until you fix B. This ensures that all applications are in sync and working properly.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions