In the past four months, we have successfully transitioned to using nx as our development framework. During this time, we have heavily relied on a shared library. However, our current objective is to break down this library into several smaller ones. We have received recommendations to approach this task by dividing projects based on domain and creating separate libraries for types, dtos, shared components, and more.
To initiate this process, I initially began by creating a type library for each service that utilized types from the existing "common" library. However, I soon discovered that certain types were interdependent with types from other services. Consequently, I had to create additional libraries, leading to a big changes in just one branch (because also I was update services at the same time)
I tackled these changes within a single branch derived from our main "develop" branch. However, I have concerns about the effectiveness of this approach, especially when it comes to documentation. I am considering an alternative strategy, outlined as follows (your input and suggestions are appreciated):
- Create a new main branch, derived from our main "develop" branch, for example, "split_common_library_main_branch."
- From this main branch, create separate branches, each dedicated to a specific task. For instance, one branch could be used to create a library named "library-x," focusing solely on the creation of the library without modifying any existing code.
- After completing the creation of a library, submit a pull request (PR) for review and merge it into the main branch (split_common_library_main_branch). Repeat this process until all the required libraries have been created.
- Once all the type libraries, for example, have been established, proceed to create another branch for updating services, with each service having its own branch.
The primary concept behind this approach is to make minimal changes per PR, ensuring readability and organizational clarity for future reference, particularly for those interested in understanding how we split the common library.
I'm uncertain whether this approach is optimal or not. I would greatly appreciate your input and any suggestions you might have to offer.