And with the monorepo you like make the change, you do all the fixes in one go and every micro front end is updated, right? So you've actually just gotten rid of that huge hurdle of working across these micro front ends by putting them in the same place. And I have a blog post about it. So you can check out like React micro front ends with monorepos perfect match.
Okay, yeah. So a question that I'm seeing here, I'm gonna rephrase it a little bit so that it's not calling anybody out, but if you've got a team where the pattern has been to create a new repo for each small thing, what is your recommendation for like helping teams work within the NX Monorepo framework when that's been the pattern before is to break everything into small code bases? Yeah, and I'm guessing that as you break code into small code bases, you're also publishing those to like a registry somewhere so that people can pull them down. I think the first thing that I would do is that I would move the publishable parts into NX and then have the different projects within the NX and you can see the relationships between them, but then you can publish those back up to, you know, artifactory, whatever, registry, and then you can start bringing it in from like higher and higher nodes of your dependency graph.
Mm-hmm. So, a question that I have is what's the difference between something like NX and other monorepo management tools like Lerna? Are they the same or are they solving different problems? Yeah, Lerna's really popular and it's really, really good for, I think, package management. So, like, NX has a lot of different packages that we manage and we don't use Lerna, but it would be nice to have something that just kind of runs everything, and that's what Lerna does. It allows you to have separate projects, but it allows you to run builds across all of them, test against all of them. But at the end of my talk I was going through, you know, running everything is going to take a really long time once you get in the scale of five, six different teams. So, when you're talking about organizations like Facebook, running all the tests takes a huge amount of time. So, NX has the intelligence, along with that, to be able to run only a portion of your projects when necessary to verify that the change is safe for production.
Got it. So, that kind of dovetails into another question here, which is how do you support big teams that are working on one repo if you have the need of something like a merge queue? I might not be as familiar with the term of a merge queue, but maybe it's like, you know, a lot of people working in the same monorepo, you might imagine a lot of merge conflicts, right? I think it's also like a misconception because merge conflicts only happen when two people work on the same thing. And it's not exactly like, you know, a thousand people working on the same piece of code, right? Everyone's working on their little slice of the monorepo. So, many times you won't get to merge conflicts, right, because you're working on something completely different from other people. The only thing is when you're working on a change that touches like, everything in the monorepo, say, like you like, change this really core thing, then yeah, there's gonna be merge conflicts when people merge their code in. But hey, you're gonna have to do it once rather than like, 50 different times across all those different teams. So, at the end of the day, that's still more efficient from a workflow standpoint, right, and yeah, the only other recommendation I have is that maybe you need this like, you know, I need this change in, let me just force push it in without, you know, getting all my approvals or like, there's a separate team that handles that kind of change. So, that's how I'd recommend going about it. Not sure if I understood the merge queue correctly. So, the question has been kind of rephrased to talk about like, a deployment queue. And so, I'm gonna talk about my own experience because I know for sure what I'm asking, just to make sure. And what I've seen is that in a lot of companies, when you get ready to do a deployment of a certain thing, so let's say that the apps front-end is about to do a deployment. There might be multiple branches going, but they will lock deployment for a window of time to make sure that the code gets merged and it goes live and everything is okay. The workflow that we use now wouldn't work in a monorepo because we'd be locking the entire company. Most of which that code is unaffected by the front-end deploying. So how is a workflow like that where I need to say, no one can merge to the UI for this window of time, how would that work? Yeah, so development workflow that works really well with monorepos is a trunk-based development. So that means everyone develops based off of master or develop branch, but all the commits go into there.
Comments