Skip to content

Instantly share code, notes, and snippets.

@visualjeff
Last active May 6, 2019 03:57
Show Gist options
  • Save visualjeff/1cda46847ae3b089c2a254461ef9ffe7 to your computer and use it in GitHub Desktop.
Save visualjeff/1cda46847ae3b089c2a254461ef9ffe7 to your computer and use it in GitHub Desktop.
Publishing a NPM module from GitHub
First, be sure make sure you've set your git user.name and user.email:
git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email EMAILADDRESS@SOMEWHERE.COM
Create new local branch to work in:
git checkout -b v1.0.0
Set version number in your project's package.json!!!
vim package.json
Make your source changes!
Add and commit changes:
git add --all
git commit -m "Description of changes"
Push changes to remote:
git push
NOTE: You'll get a message to set the upstream on the remote:
git push --set-upstream origin v1.0.0
Switch over to master branch:
git checkout master
Merge feature branch into master:
git merge v1.0.0
Push to updated master to remote:
git push
List out all of your tags:
git tag -l
Switch back to your feature branch:
git checkout v1.0.0
Create a new tag:
git tag -am "Description of changes" 1.0.0
Switch back to master branch:
git checkout master
Push your tags up to remote:
git push --tags
Publish on NPM:
npm login
npm publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment