Publish Your Node Library to NPM
Alright, contuing from yesterday we want to take our little Node module and make it available to the world as a really awesome command line tool.
The first thing we need to do is register an NPM account.
npm adduser
Fill in your credentials and it should be ready to go.
If we have any dependencies they should be added to our package.json
file. Our simple compliment
program doesn’t need any extra libraries but we’ll add xml2json
just to demonstrate how it’s done.
Since we’ve changed our package.json
we need to run npm link
again to install the dependency. After that you should have a node_modules/
folder in your project root.
Let’s put this baby under version control!
Final step: npm publish
BOOMJAMS! We have us an npm module! - Rob
You should follow me on Twitter here.
- Mood: Hyper
- Sleep: 5
- Hunger: 1
- Coffee: 1