You need to put everything together in one gigantic monorepo. We ourselves, we build monorepo tools, right? Yet we have multiple monorepos. There's the NX repo for open source code and plugins and the like. There is the NX Cloud repo for infrastructure and closed source code. And then there's the NX Console repo, which is open source. It could probably be in the NX Open Source repo, but it doesn't need to be. It's version independently, different teams work on it, so it's fine to keep it in there. So the same applies for you. Most likely, you can start adopting monorepos incrementally, group together whatever makes sense to you, and don't let anyone else tell you to organize your code.
Hello. So for this next section on tooling, I'm going to use NX as an example. But there are a lot of other monorepo tools out there, and I encourage you to go to monorepo.tools, which is a website with information where you can learn all about monorepos and the tools to build them. And all of those authors from those tools, they collaborated on the site. So it is as fair and unbiased a comparison as it can be. Hello.
Right. So I'm going to make a bold claim, which is running tests takes time. Okay, maybe it's not quite the hot take I thought it would be, but it's true, right? So if we put more and more projects in our monorepo, and there are more and more tests in our monorepo, then doesn't that mean that the time to test, especially in CI, will go up and up and up and up? Well, yes, but also no, because good tooling can help. So through analyzing your imports, and your files, and your configuration, Enix can build this project graph of your project of your workspace. You can see an example I like to use here. There is a cart application and a product application that probably work together in some micro-frontend module federation setup. And there are some libraries that they share, and there are some libraries that are just for them. So through this, it actually becomes very easy for Enix to see what is affected by a certain change. Right. So I make a change to the products detail page, and Enix will tell that we will need to retest, build and lint, no, not lint, rebuild and retest the products app, as well as rerun and test for the products app to make sure everything still works. But there's no way that I could have broken the cart application because there's no path in this graph from the cart application to the product details page. This makes CI a lot simpler as well. Instead of some long list of steps, we can just say, Enix, please retest, lint, build, run and test for everything that's affected by this change. That's it. That is your CI configuration now.
Comments