The most popular way of making a package available to developers is by publishing it to npm, the package manager for Node.js.
We used it in all the examples in this book and you have seen how easy it is to install a package; it is just a matter of running the npm install package, and that is it. What you may not know is how easy it is to publish a package as well.
First of all, let's say you move into an empty directory and write the following in your Terminal:
npm init
A new package.json will be created and some questions will be displayed. The first one is the package name, which defaults to the folder name, and then the version number. These are the most important ones, because the first is the name that the users of your package will refer to when they install and use it; the second helps you release new versions of your package safely and...