Cheat Sheet about NPM

This site is a reply to


By now, I am maintaining some JavaScript packages on npm. These bash aliases can help me smootg my publishing experience:

  • alias breaking='pre-version && npm version major && post-version'
  • alias feature='pre-version && npm version minor && post-version'
  • alias patch='pre-version && npm version patch && post-version'
  • alias post-version='(npm run build; exit 0) && git diff --exit-code && git push && git push --tags && npm publish'
  • alias pre-version='git diff --exit-code && npm prune && npm install -q && npm test'

If you are using GitHub, don't forget to publish a release there, too. Apply a git tag to pinpoint the git commit.