If you want to create and publish npm package you must complete theses steps:
1. Create a profile
Go to npm website and create a profile.
2. Create package.json file
Create a folder for your package and change the current directory to it:
mkdir my_package cd my_packageCreate package.json file:
{
"name" : "my_package",
"description": "package description goes here",
"version": "1.0.0",
"author": "Firstname Lastname <firstname.lastname@mail.com>",
"keywords": ["my_keyword1", "my_keyword2"],
"repository": {
"type": "git",
"url": "https://github.com/myuser/my_package.git"
},
"main" : "./lib/my_package.js",
"engines": {
"node": ">=0.8.8"
}
}
3. Link with npmLink your package with npm:
npm link4. Publish the package
Add a user:
npm adduserPublish a package:
npm publishIf you want to override published package you can user --force parameter:
npm publish --force