![]() Pnpm only needs to have a root package.json file, and a pnpm-workspace.yaml that describes where the child packages are located. To setup pnpm workspaces is straightforward. Here is a recap of the time it took to install all the packages dependencies in our monorepo:Īs you see, pnpm is faster and better on all metrics: This was especially obvious in a monrepo setup where pnpm showed impressive results. Pnpm stood out as considerably faster when evaluating npm, Yarn, and npm. A contributor can lose patience very quickly if they have to wait for several minutes before installing the package's dependencies, and CI jobs will suffer, too, given some are executed on each GitHub push and pull request. However, managing multiple packages in a workspace is a challenge regarding performance. In the past, only Yarn supported workspaces out of the box, which made it a great candidate for monorepos, assisted by Lerna to handle package versioning. When we were deciding what package manager to use, it needed to have support for workspaces. These were the problems we had before moving to a monorepo. We wanted to make it easier for developers to find and contribute to our code in a single entry point. It was also hard for our community to get a good overview of the different packages we maintained. Visibility: Having 10+ repositories made it hard for the Nhost community to find the right package if they wanted to explore, contribute, or create an issue. It would be better if shared code and patterns would be accessible for all packages. It ended up lowering the code quality and increasing engineering overhead. Having packages in separate repositories meant we were duplicating code or solving similar problems in a slightly different way from one repository to another. Reusability: Our packages often needed the same helpers or generally used the same patterns. We felt there was an opportunity to share each other expertise by working in the same repository. Every engineer tended to “own” their repository in a siloed way. Siloed: Little collaboration and knowledge sharing occurred among team members. Since almost all packages required the same configuration it was important to centralize it to have a single source of truth. Again, slowing down our development process. This type of manual work was not always done correctly, which led to configuration mismatches between repositories. ![]() If we did one change in one package, we had to manually change the other packages to have the same configuration. Instead, we wanted a single process that would watch all packages to rebuild and link them automatically during development.Ĭonsistency: Each package and repository had a separate eslint and vite configuration. We found ourselves creating sym-links and copying code between folders which slowed down our development process significantly. Refactoring: The packages usually depended on each other, making it hard to synchronize them during development. Instead, we wanted a standardized CI/CD setup for all packages, without having to repeat our selves. It was inefficient and difficult to maintain, and we could hardly ensure the same level of quality and ensure the npm packages were structured in the same way. Ideally, this would ba automated.ĬI/CD: With the packages spread out in separate repositoris, we had multiple ways to test, build, version, and release our packages. ![]() As an example, if package-a depended on package-b, and package-b was updated we had to manually update package-a with the new version for package-b. To understand why we wanted to move to a monorepo it's important to understand what problems we had before the move.ĭependency management: Dependencies had to be manually managed between packages. In this article, we will explain how we configured them to work well together. We chose pnpm as our package manager and Turborepo as our build system. We decided to move to a monorepo to solve these issues. Development started to get slower and slower, and we were not able to move fast anymore. ![]() Things started to get inconsistent and out of hand. 12 months ago, we had 10+ npm packages in individual repositories. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |