00:00 Let's open our package.json in our code editor and inside of our scripts, let's add a new script called pre-publish. Let's have this run npm run build. We need to make sure we add a comma above. Now what this will do is whenever we run the npm publish command it says, "before that's run, run this," which npm run build will run our build script.
00:26 This command is going to ensure that when we publish a package it has our latest build. Next, let's create an npm ignore file. Inside that file let's add the source directory. This tells npm to install everything except for what's listed in the gitignore and the npm ignore.
00:47 If we didn't have this source here, every time someone npm-installed our package in their node modules inside of their project they would also get all of our source files. Now let's save and close this file and go back to our terminal. Now let's run npm-adduser.
01:03 We type in our username and our password, our email. Now it says that we've been logged in to the npm registry. Now we can run npm publish. We can see that our build script was run and we can open up npm and view our package.
01:17 It shows our package name, description from our package.json as well as the example from our readme document. Now other programmers can run this command and use our package.