Search code examples
nestjsmicroservicesrefactoringmonorepolerna

monorepo updating one nestjs app from nestjs v7 to v8


hello guys I have a monorepo that has 2 microservices

  • microservice 1(nestjs@v7)
  • microservice 2 (nestjs@v7)

and a shared packege

  • shared package that use (nestjs@v7)

both of the microservices use and import the shared package (has all models typeorm models and business logic)

now I am trying to upgrade one of the microservices (microservice 2) to (nestjs@v8) but actually it is breaking and showing errors in the shared package.

I am thinking that the problem might be that we cannot upgrade one of the microservices without updgrading the shared package to the same nestjs version since the microservice is importing the shared package

[note] we are using

  • lerna
  • mono-repo
  • redis
  • typeorm
  • socket

Solution

  • solution

    we cannot simply upgrade one microservice without upgrading the others.

    why?

    simply because of our shared package that we use in both microservices is using nest@v7 all the microservices that use it need to run the same nest version.

    conclusion

    it seems that the one thing that is an advantage of using monorepos which is having a single place for shared code is also a disadvantage at the same time.