JavaScript and TypeScript Monorepos

Lerna Commands for Release Management

JavaScript and TypeScript Monorepos

Check out a free preview of the full JavaScript and TypeScript Monorepos course

The "Lerna Commands for Release Management" Lesson is part of the full, JavaScript and TypeScript Monorepos course featured in this preview video. Here's what you'd learn in this lesson:

Mike demonstrates how to use Lerna to bump the version of packages changed since the last release of a monorepository, and walks the students through the changelog generated by Lerna.

Preview
Close

Transcript from the "Lerna Commands for Release Management" Lesson

[00:00:00]
>> We can see how Lerna interprets this. And we're going to look at a couple other commands here. So one of them is changed. Right list the local packages that have changed since the last tagged release. Now we don't really have a tag release, yet. So this is going to be a little weird.

[00:00:24]
We have a list that tells us just helps us understand which of the packages learn a C's and is managing the version of and then there's version. So bump versions of packages that have changed since the last release. Let's try that one. So now it's asking us to pick a version number 001 is what we found in that was what we started with in our package, JSON.

[00:01:02]
And now it's like letting us choose something here. And you can see that it is smart about incrementing. Right, so if I want to cut a patch that's a to a minor. Well, I'd go from middle digit from 0-1 So this is all contextually relevant here. Custom pre release would be like cutting a beta or a release candidate.

[00:01:23]
Sometimes you see RC as this last little, you know, this is a colonel December calls this it's like a custom release specifier or something Little here. It's important to realize that these are sorted alphabetically. I know if someone who run too little problem, they're tryna make a little cute joke where they, I guess an April fools joke.

[00:01:52]
They cut a release With a version, so their current real release was a beta, and they cut a release with a specifier that started with AES, thinking that it would just be funny. But all of the people that were on the beta there, they ran yarn install, they saw a new thing was available and they pull back down.

[00:02:13]
So, alphabetically matters. A is for alpha, B is for beta. You don't want to keep going down the alphabet because those will be seen as more stable than a beta. Let me try something else here. Check that out. So I added this conventional commits argument. And it's not asking me a question anymore.

[00:02:45]
It's telling me that I'm bumping up to two. What are we doing here? Crap, my tag already exists. All right, here's what I'm gonna have to do. And this is only because I ran this workshop project. Like while I was testing things out, making sure it was working for you.

[00:03:09]
So I'm going to have to do a little workaround you won't have to do locally. I'm going to call this a minor release. Because I've already I have some get tags that already exist. In fact, I'd better call it a major, just so I get completely out of anything that I was doing before.

[00:03:28]
Right, this is new territory. It's been no part of any of my dry runs here. And now you can see that it finishes. So but this is I would expect this to fail right? Like I already have a tag 002 and I like that learner is being honest about that.

[00:03:43]
And it's telling me like I already published this release. Are you sure have you pulled that latest code from Master? Maybe someone else cut a double two already. No, check this out. Ccnagelog.md so this is in the root of the project. And you can see i've got 002 this was for my patch release I probably should've reverted this, I shouldn't have committed this.

[00:04:15]
It's not gonna really cause harm here, but like. don't really want this to say 1.0. And now we've got this little description here and if we've done our job, right, each package also has a little change log here. So we didn't make. We said that our inner commit message we said that it was, I believe utils, Hopefully, where's my commit?

[00:04:45]
I can just do git log. Right so we touched utils. So that means that types, right? It's just a version bump only Version bump only meaning, like types didn't really change, then really change. Now if we looked at the utils change log or commission show up there. Maybe I spelled something wrong feet utils.

[00:05:16]
Well, the hope is that it would show up here And it's certainly showing up here. I may be getting the syntax slightly wrong, but I hope you understand the concept here. This is where I'm probably just a little bit off in the convention, but you would want to see that specific things.

[00:05:39]
Then, in fact, certain packages show up in the respective changelog they belong in. Now, the reason that we released new versions of both of these packages is because of our versioning strategy here, right? So this number has changed. It used to be 01. And now it's 1.00 Means all of the packages in our workspace are tracking that same number, this is the lockstep versioning strategy, we're not always going to make things like this, we are going to get we're going to let some of these things float independently in just a moment.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now