July 15, 2020component librarieslerna
This post is part of an ongoing series about the problems you’ll need to solve before you start building a component library.
Have you ever sat down to write a blog post, essay, email, or feature, and suddenly your mind goes blank? You watch the cursor bounce, taunting you, until you can’t take it anymore. You have to grab an ice-cold LaCroix from the well-stocked fridge of the trendy startup you work at. Ahem…sorry I just started fantasizing about pre-quarantine life.
If you’re anything like me, you probably feel this way trying to make the initial decisions about a component library. How can you possibly make a decision about the repository structure of your library when you don’t even have any components yet?
One of the reasons writers experience blank page syndrome is because they could literally write about anything. Luckily, in this case you really only have two options.
If you’re unsure whether to choose option #1 or option #2, and you don’t have a lot of time, and for some reason you really trust a stranger on the internet with your decisions, I can solve that for you right now.
Use a lerna-managed monorepo.
Now…even if you totally buy what I’m saying, you can’t just go back to your team and say that some stranger on the internet told you what to do. (I mean you could, but you might not be put in charge of making any other decisions.)
I don’t want you to have to go off and do a ton of research to justify building a monorepo. To save you some of that time and stress, I compiled a pros/cons list for both approaches.
npm linkcomponents that rely on each other across repos
In this section, you can assume I’m talking about lerna-managed monorepos. Lerna provides two versioning schemes, fixed and independent. I’ll note below whether any of the points refer to one or the other. If you’re unfamiliar with Lerna, you can read a bit more about it.
If you’ve decided to go with the monorepo approach, you’ll need a way to manage your packages. Enter Lerna.
If you haven’t heard of Lerna yet, don’t worry about it! I can definitely help you out! Just start here.
Are you researching monorepos and Lerna for something you’re building? What are you stuck on? I’d love to hear from you. You can reach me on Twitter or by responding to any of my newsletter messages. (Seriously, I really want to hear from you.)
If you liked this post, please consider sharing it!
Sign up for the Design Systems Newsletter today!