NPM and the Node ecosystem

After one month of hacking around with Node.js, I created and distributed my first package. NPM is the repository of all kind packages that you can think of. At this moment, there are 28 698 packages in NPM which is a lot for a 4 years old project. The philosophy of Node and its community is to keep the core tiny and encourage composition with small modules that do one thing well.
In that sense, I wrote a small facebook API client that I called tiny-facebook-wrapper, as you can see in the figure. The package.json and .npmignore are two important files to have in any Node.js package. In a nutshell, the first one is the descriptor of your package with the author, version, dependencies, etc. The second one is used for keeping off things that you don’t want to share in your package, such as, docs, tests(?) or other superfluous files. Don’t forget to document your package in a README file with some hands-on examples of how developers can use your software, they will thank you from the bottom of their hearts.

Now that I have my module ready to share, I can create a dev account in the NPM registry directly from the command line:


$ npm adduser
$ Username: davidcunha
$ Password: ********
$ Email: davidgoncalvescunha@gmail.com

Publish the module:

$ npm publish

And that’s all folks, my small facebook API client is online for the community to use it:

Simple, right?

Advertisements
Tagged , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: