That was the moment I saw with my own eyes how amazing it's working a monorepo. With the bare minimum setup, I started to create even more small independent modules/apps to re-use, extend and try out new tools without impacting my existing code. Still, I managed everything and had a decent setup. Of course, along the setup process, I had had some gotchas like understanding why some builds were failing (not all apps likes hoisted dependencies), had to adapt my pipelines, and how I deployed each project. I tried some solutions, and the easiest way to get up and running was Lerna + Yarn Workspaces. The tools need module/file resolution, and I didn't want to ship all projects when I was about to deploy.Īt that moment, I realized I needed a monorepo tool to do this linking and make my experience better. Unfortunately, I couldn't simply drop the files there, extend, and hope it works because things are more complex than that. My first instinct was: What if I put all projects inside a single folder and repository, create my base config and use it to extend each project's config? Every new thing I learned like a new eslint rule, I agree, I had to go in there and change three times and so on. Soon, I became bothered by every dependency update (like TypeScript) I had to update in all repositories (three pull requests). I had 3 git repos implied that I had 3 eslint, prettier, jest, babel, and typescript configs, but I handled it for a while. Once again, another new git repository containing its code and setup. Then, I decided to fork a library called mdx-prism to fix some minor problems and automate its deployment. Then I created a Strapi application, put it into another git repository, and pushed it to another Github repo. When I first created my blog, I bootstrapped a Next.js application, put it into a git repository, and pushed the scaffolding code there.Īfter a while, I needed to set up the CMS to hold my content. Yet there's one ("new") option that might help us in most cases: pnpm workspaces.īut before talking about pnpm, let me tell you my monorepo/workspaces usage and how I managed to solve that in the first place. Unfortunately, we don't have a killer tool that fits all types of JavaScript/Typescript projects and all sizes of teams, and that's understandable. If you Google "monorepo tool javascript", you'll find many articles showing the most popular options we have, and curiously each one attempts to solve that problem in a very different way.įrom the options we have, some are there for a while (like Lerna) but no longer actively maintained others never went out from draft (like Bolt), others are working fine but only for a specific kind of project. The biggest challenge, though, is finding an easy-to-use tool for handling such a structure. Monorepo architecture has become more popular over the years, which is understandable considering the problem it solves. This article was published on Nov 17, 2021, and takes approximately 10 minutes to read. Replacing Lerna + Yarn with PNPM Workspaces
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |