Friday, February 4, 2011

Creating a NPM package

NPM is a package manager for node.

Creating packages with NPM is not difficult so here are the steps.

1. Creating the package.json


Here is an example
{
"name": "packagename",
"version": "0.0.1",
"description": "Package description",
"main": "package.js",
"keywords": [
"foursquare",
"4sq"
],
"repository" : {
"type" : "git",
"url" : "https://yikulju@github.com/yikulju/Foursquare-on-node.git"
}
}


2. Linking it with NPM


npm link

3. Publishing the package


First, you have to create a user in the repo.
npm adduser

Then you can publishing the package
npm publish


This is a good resource (Introduction to npm) but for some strange reason it was difficult to read, maybe the writing style.

No comments:

Post a Comment