NPM Packaging for fun and profit
Definition
NPM = Node Package Manager
Roughly same relationship to Node as
Gem's relationship to Ruby
Why Write an NPM Package?
Don't you want to be cool like the other kids?
I can't think of any other reason...
What are my credentials?
I've written 3 NPM packages:
dsigner - published in the Node registry
ws_server - installed from GitHub
irobot-client - installed from GitHub
dsigner
A node package that provides public-key data signing and signature verification.
(https://github.com/naiveroboticist/dsigner)
I needed the same code in two other applications (ws_server and irobot-client), but didn't want to duplicate the code.
Package Layout
dsigner/
bin/ # executable scripts
lib/ # module code
test/ # tests (mocha/chai, jasmine, etc.)
package.json
package.json - Overview
Serves the same purpose as a gemspec in Ruby. Provides a description, metadata and dependencies for the package.
dsigner / testing
$ npm test # in your project directory
Installing a Package
$ npm install [-g] dsigner
$ npm install [-g] naiveroboticist/dsigner.git
$ npm install [-g] # If you are in your project directory
Uninstalling a Package
$ npm uninstall dsigner
Publishing a Package
$ npm publish # from your project directory
The registry: https://www.npmjs.org/doc/misc/npm-registry.html
Not as pretty as Rubygems.org