package.json
file. Required fields are name
and version
.package.json
.Just follow the instructions on Github.com and you’ll be good.
Go to your favorite project directory and type:
$ git clone git@github.com:my-account/my-module.git
Now it’s all up to you. Do your magic and add your module. Don’t forget to do unit testing and add a CI integration like Travis.
To create a package.json
file just type:
$ npm init
Or if you already have one in your repo make sure name
and version are added. All versioning are according to Semver.
When your done with all your hard work. Push your changes to Github.com. Just type:
$ git push origin master
Now it’s time to make a release on Github.com. It’s good practice to do this before you publish a new npm package. You can do the release on Github.com or you can use curl
from command line:
$ curl --data '{"tag_name": "0.2.0","target_commitish": "master","name": "0.2.0","body": "Release of version 0.2.0","draft": false,"prerelease": false}' https://api.github.com/repos/my-account/my-module/releases?access_token=:YOUR_ACCESS_TOKEN
Now it’s time to create an npm account. Jump to the “Create an account at npmjs.com“ page and follow the instructions.
When you’re done go back to your repo and type:
$ npm login
# Check login
$ npm config ls
This is very easy. Just type this in your repo folder:
$ npm publish
Now check your new shiny package.
Remember to bump the version inside package.json
. Use Semver to figure out which version you should bump to.
Push your changes to the master branch:
$ git push origin master
Now it’s time to make a release on Github.com. It’s good practice to do this before you publish a new npm package. You can do the release on Github.com or you can use curl
from command line:
$ curl --data '{"tag_name": "0.2.0","target_commitish": "master","name": "0.2.0","body": "Release of version 0.2.0","draft": false,"prerelease": false}' https://api.github.com/repos/my-account/my-module/releases?access_token=:YOUR_ACCESS_TOKEN
This is very easy. Just type this in your repo folder:
$ npm publish
Now check your new shiny package.
That’s all!
If you have any comments please feel free to add them below.