Publish your npm right

Introduction


I've been working hard lately to publish my last works. For some time I was working on an evaluation platform for IT recruiters. The idea was to be able to create quizzes and auto-evaluate them. At the beginning I was thinking of a full website to generate and evaluate. But with the time clock going on, I decided to focus on the evaluation engine.

To more easily integrate it on my other projects, I decided to make it an express middleware and to share it as an npm dependency as of the node philosophy is do one thing but do it right.

How to


To allow users to access your package easily  and to avoid breaking things, you should create a tag version for your package according to your packages.json :


git tag -a v0.0.1 
git push --tags

Actually it was really easy to publish it. First of all, you'll need an npm account by typing the following commands :

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"
 
npm adduser

After that you'll only have to publish it on npm :

npm publish ./ --tag v0.0.1

And that's it, your package is online with the specified tag installed by default.

Conclusion


Remember to carefully manage your tags to avoid breaking your users applications and try to use continuous integration to maintain more easily your project.

Go have a look at mine : https://www.npmjs.com/package/hupothesis

Have fun

Most seen