Loading
Current section: nx 20 exercises
lesson

Automated npm Package Publishing with Nx

In this course, we're going to learn how to ship npm packages. While most developers have probably taken a crack at this once or twice, our aim here is to streamline this process as much as possible.

Using Nx for npm Package Automation

We'll be utilising Nx, a tool originally created to manage

Loading lesson

Transcript

00:00 Hey, my name is Juri Strumpflohner and I'm super excited that you're joining me on this course. So what we're going to learn here is how to ship npm packages. I guess most of us have already done that once in a while in our career, but what we're going to do is to see how we can actually

00:15 do this in the most automated way and the most straightforward way. So for this whole process, we're going to use NX, Leverage's functionality. NX is a monorepo management tool, but most recently also has a new feature called NX Release, which allows us to exactly automate some of the

00:31 aspects of versioning, change of generation and also publishing to some registry. In our case, most probably npm. So what does the structure of this monorepo look like? It is actually an npm workspace. And so if we go here and check out the product structure, you can see we have

00:48 a bunch of different packages, which is our fictitious design system library, where there are dependencies between these packages, which will allow us to explore some variations of how to version things. So versioning between groups, versioning between dependent packages, but also in the release process to make sure that if we release, let's say, the forms package here, that

01:07 @slateui/icons has been packaged and published successfully. Otherwise, we would run into an inconsistent state online. So how is this course structured? I'm actually going to first explore different variations and features that NX Release has, such that you have a big picture or actually

01:23 good picture of what is possible. And then we're going to dive deep, leveraging the actual programmatic API of NX Release to create our custom release script that will fully automate on GitHub actions, including npm provenance support. So I'm super excited. Hope you as well. So let's go.