- [Instructor] So first of all, I created a new account
on NPM to help demonstrate some of the things
we need to do.
Be aware that if you want to publish private packages,
you need to have a paid account.
Otherwise, if you wish to publish your packages publicly,
a free account will suffice.
So, we need to make a few changes
to our project here, because there's already
a project named test-npm from the previous course,
so we need to make a few changes here.
So what I'm going to do first, get out of VS Code.
Okay, so let's go to NPM here,
and copy the content into our desktop.
So I'm going to copy that, so copy
and then paste in here, like so,
and then completely delete all the content
inside of that folder here,
and then we'll go back to VS Code,
and then we'll do a brand new init.
Before we do this, make sure that you do an npm login first,
I already did this, so do npm login,
and then enter your credentials.
Once you're logged in with NPM,
you can go ahead and do a brand new project,
so we'll do npm init.
For the package name, do something
that is completely out there,
so you're not using a name that's already been used.
So in this case, I'm going to do npmtesty23,
and then that's version one.
No description, no.
And then the author will be the name
of the new account that I created, which is my company.
Perfect, so we got a brand new package,
with a brand new name, at version 1.0.0.
So then what we're going to do is add the content
that we had before inside of this particular folder,
except the package.json file, and the package-lock.
You can actually delete that one.
So we're going to add the .babelrc file and the index,
and then we'll either right-click on Windows,
or drag-and-drop into a new VS Code window
this particular script file.
So I can copy some of the code.
So we'll copy the scripts here,
so copy the scripts, and then bring them
into the new project,
and then we'll copy the dependencies, so line 13 through 21,
and then put them right after line 12,
so we'll put a comma here and then paste,
and that will constitute our brand new project here,
so you can save that.
You can close the other one,
and then we can put this in the garbage as well.
So we have our brand new project
that is ready to be published to NPM,
so let's go back to VS Code and let's do exactly this.
So let's clear that up.
And a way to publish to NPM, you do npm publish,
and let's add a tag, I don't know if you remember,
in a previous video, we visited a how to do this tag,
we'll do a tag for this one.
So this one will be, so for example, the beta version.
And then that's all you need to do.
So let's hit Enter, and if you see,
this kind of messaging, without any warning,
that means it's working.
So right now, we have this published to NPM.
And then we're going to check how
we can use this in a future video.