Loading
Current section: nx 20 exercises
lesson

Customizing Changelog Formatting in Nx Release

nx release comes with some default settings for how our changelog rendering looks.

version plan

By default, we can see:

  • A title alongside the version number
  • A rocket emoj
Loading lesson

Transcript

00:00 So @nx/jsON already has some defaults when it comes to how the rendering of the changelog looks like. So here, for instance, you can see there's a title alongside the version number. You have this rocket emoji alongside features. And at the end here, for instance, we have the authors being mentioned as well. Now you can customize how this looks like. And as always, you do that in the @nx/jsON

00:19 at the root of your workspace. And @nx/jsON has a specific node that is called changelog. And so you can add this specific node in here. Now you can define and customize whether you want to just have a workspace changelog, which means just one single one that summarizes all of the changes at the root level of your workspace,

00:36 or you want to have filtered per project changelogs. And you can also have both of them. So for now, let's just customize here the workspace changelog. And I get some nice here preview and autocomplete by cursor, which is nice. So basically here you can define how these render options are being set. By default, they are all true.

00:55 And so here, for instance, you can see we have authors as being true. So that means that this author section at the end will be rendered. You can see your map authors to GitHub usernames. This is useful if you push your releases also to GitHub. So this here is an example of the Nx repository where releases are being pushed to GitHub as well. And so you can see a similar format

01:15 of the changelog actually being rendered here. And at the end, you have the author section that we have also seen locally, but it also maps them to the actual usernames, which is nice because then these users, which can be external contributors as well, get a nice notification as a thank you for having contributed to this release. And so you can define these in here.

01:34 Let's say, for instance, we don't want to have the title alongside the actual version, we could change this. And let's say for some reasons, we don't want to have the author show up. And so if you just rerun here a new release, I just run this in dry mode, so we just get a preview. You can see here now the actual date has disappeared alongside the version information,

01:55 and there's also no author section at the end. Now you can go even a step further, especially if you use conventional comments, there's another node that you can customize, which is here the conventional comments option, which allows you to define types. And let's say we want to go and define a feature type, and we want to expand this one here.

02:15 And so in here, we can say, I want to have a changelog entry and customize here how the title looks like. For instance, I want to have this rocket, but I want to say new features and two exclamation marks, because I'm super excited about all new cool stuff that we are releasing. And so again, if I rerun a dry run release here, we get a new changelog,

02:35 and you can see how this takes effect in here. You can also customize which node shows up, so which type shows up. So in this case, with conventional comments, we also have some docs change that we made just recently in here, but by default docs change don't show up in a changelog, but maybe that's not something that you like. So you can actually go ahead and say docs

02:55 and set it to true. And so if I now release again, we can see how also the docs changes are being shown in our changelog.