Transcript
00:00 So until now we didn't configure really how NxRelease should behave in this workspace and this is intentional because the NxRelease comes already with some defaults baked in so we don't really have to configure anything. But if you wanted to you could have here such a release property in @nx/jsON which you can then use to customize how NxRelease behaves and what we
00:19 are going to do in a bit. For now though we are going to use the interactive mode of the CLI to version our packages. So if you go and look into our packages right now all of them are set to version 0.0.1 which is the first version usually you use when getting started when you didn't
00:34 re-release anything and so all of them are set to this specific version. You can also see that these packages have relations between each other. So for instance if we go here in this button library you can see it references here SlateUI core which has a star in here meaning we depend simply on the latest version which means we will depend on some local version that is being
00:53 installed here. Now we could obviously also here say we want to depend on 0.0.1 of SlateUI core and given SlateUI core here has the package version 0.0.1 the local version would be used. You could even go ahead and specify a different one which in that case npm would try to pull it
01:12 down from the registry. You can also visualize these dependencies with Nx and there's a command it's called NxGraph and if you then head over to the browser window you can see it set here show our project and you see how our workspace looks like and in fact you can see here our SlateUI
01:27 core which buttons depends on but also forms depends on and SlateUI themes depends on. These relationships are important especially also afterwards for running the versions. All right so now we're ready and we can actually go ahead and release our version 1.0.0. Let's say we want to do that and so again we run NxRelease which is the main command.
01:48 Now again I'm going to use here the dry run so we can see what is going to happen and whether that's what we actually want and expect and only then remove the dry run and confirm the actual versions being applied to the workspace. Now let me use the shorthand notation just minus D and so again we're being asked here what type of change you want to make. Also note
02:08 here it says it's gonna do that for five projects that are being matched and so we want to release a major version because that will be the first part of the version that we want to increase so 1.0.0 and so there's a major version and it gets applied to all the packages. Now for a sec let's
02:24 have a look at the locks here which are actually quite interesting because they're pretty detailed but they allow you to understand how NxRelease works behind the scenes and the process it uses to apply these versions. So here for instance we say we see that it's going to run this release version command on the SlateUICore package first and it reads the data for that package from this
02:44 location which is correct. This is what we expect. It resolves it currently to be 0.0.1 again that's fine and since we have defined we want to have a major release it would write the new version as 1.0.0 which it writes back to this package json file. Now interestingly also it applies the version
03:02 1.0.0 to three packages which depend on SlateUICore. So we've just seen here in the graph we have these three packages that depend directly on this core package and so therefore in the respective package json dependencies the version needs to be updated as well since we changed here
03:19 the new version to be 1.0.0 and it does the same for all the other packages so for the buttons, themes, forms and icons. Now further down here you also have a nice diff output here which makes it even more clear what is being changed in your package json files and if you scroll further down there's a bunch of more logs being printed out. Now one thing to note here is this one here
03:39 which is kind of like an error that's being printed and what it says basically is that there's no previous git tag that has been found and most probably the reason is because this is our first release which indeed it is so there is no tag that any previous release would have been would have added and so here the suggestion is to either use the first release option that we can
03:58 add to our nx-release command or configure the nx-json properly using this command here. So let's fix that by re-running the nx-release command and this time we pass first release because indeed it is our first release and I'm not going to specify the dry run here because I'm pretty confident
04:14 it's going to work this time around. So we want to read the major version that's fine so you can see the version is being applied you can see here it updates the log file it also generates a small changelog file which we're going to have a look in a second stages the changes in git and also
04:28 commits them and then applies a tag in git. Now it also asks whether we want to publish this version and we're not going to do that right now so let's keep the default here which is false and just not do that here and skip it. All right so let's see what happens if we go for instance to
04:45 the forms package we can see the version got incremented to 1.0.0 so that's what we expected and the forms package is also dependent or depends on a couple other packages like buttons icons and core and you can see all of these have also been properly updated here in the dependencies
05:02 of the form package. Now as we've seen before we also got here a small changelog file generated and so this simply says this was a bump version bump only there were no code changes which indeed is actually true we didn't change any source code we just ran the first version 1.0.0
05:18 release and we're going to have a look at changelogs in a couple lessons and later. Now if we look at the history here you can see a new commit has been created that says store release publish version 1.0.0 and also applies the tag here 1.0.0.