Today I just published my first package hlsdownloader to npm. It is pretty easy to publish a package to NPM
I am assuming that you have NodeJS installed in your system.
Configure your account
If you haven’t already set your NPM author info, please run the following commands
npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://your-website-url.com"
npm adduser
Create Package JSON
Now you need to go to your project’s root directory and run the command if you don’t have any package.json answering the questions it asks.
mkdir my-awesome-module && cd $_
npm init
Add your dependencies
If you are not sure about the dependencies of your package you can easily find out installing this
[sudo] npm install -g pakmanager
# this shows you dependencies as you `require`d them
pakmanager deps
Now add your dependencies with appropriate versions like below
...
"dependencies":{
"dependency-package-1": "version",
...
}
...
Publish your package
Now you are ready to publish your module. Just fire this command in your terminal.
npm publish ./
Thats all!!! take care. If you have something to say or ask I am all ears 🙂
WARNING: Once a package is published with a given name and version, that specific name and version combination can never be used again, even if it is removed with npm-unpublish See this issue