Skip to content

Instantly share code, notes, and snippets.

@klamping
Created July 21, 2015 19:26
Show Gist options
  • Save klamping/a4298ea2632378650e0e to your computer and use it in GitHub Desktop.
Save klamping/a4298ea2632378650e0e to your computer and use it in GitHub Desktop.
Example NPM Version Scripts
{
"name": "npm-module",
"version": "1.0.2",
"repository": {
"type": "git",
"url": "https://github.com/myuser/myrepo"
},
"scripts": {
"test": "eslint --env node ./",
"preversion": "npm test",
"version": "conventional-changelog -i CHANGELOG.md -p eslint -w && git add -u",
"postversion": "git push && git push --tags && npm publish"
},
"devDependencies": {
"conventional-changelog": "~0.1.1"
}
}
@klamping
Copy link
Author

Run via npm version patch (or minor, major, etc).

This tests my code (just linting since it's just a shared ESLint config), updates the version, then updates my CHANGELOG.md file with my updates, then adds, commits, pushes and publishes the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment