How to manage versions on monorepo with application requires to support multiple releases

releaseversioning

I try to figure out how to manage versions in an monorepo where one of the packages is an application that needs to support multiple releases.

Assume we have a monorepo with just two packages: lib and app:

repo:
- lib@2.0
- app@1.0 (depends on lib@2.0)

app@1.0 is released release-app-1.0 tag is created.

We continue to make changes to the code and the repo becomes:

repo:
- lib@2.1
- app@2.0-beta (depends on lib@2.1)

Now a customer discovers a bug in app@1.0 caused by code in lib@2.0.

Where should I fix this bug?

Ideally, since lib currently is in 2.1, I should fix the bug in master and release lib@2.1.1, and update app@1.0 to use lib@2.1.1.

But in practice, it poses a few challenges:

  1. We need to first checkout release-app-1.0 first to figure out app@1.0 is using a SemVer compatible lib in order to determine we can implement the fix in master.
  2. After we make the changes in master and release lib@2.1.1, should we (and how) back port all those changes to the release-app-1.0? It would be close to impossible to cherry pick all changes only related to lib from master to release-app-1.0. But if we don't do that, then when we release app@1.0.1 and create tag release-app-1.0.1, the monorepo link between app and lib is broken (app@1.0.1 depends on lib@2.1.1, but in that tag lib is still in 2.0)

On the other hand, if we fix lib@2.0 directly and release lib@2.0.1, we do not get any benefit of using SemVer and get all the new features/bug fixes in lib@2.1.

Any suggestion is greatly appreciated. Thanks.

Best Answer

Theres no solution to this problem where you automatically get the fixes you apply to earlier versions in later versions.

You have to fix v2 and release v2.0.1 and seperately fix v2.1 releasing 2.1.1

For all you know v2.1 has been completely refactored internally. The code change you did to fix 2.1 might not even compile in 2.1

The Cherry Pick is a Lie!

Related Topic