- patch-release
- minor-release
- major-release
- clean-up
- [Bower postinstall](https://github.com/npm-scripts/scripts#Bower postinstall)
- gh-pages
- develop
- diffy-package
Publish a patch release of a package
"scripts": {
"patch-release": "npm version patch && npm publish && git push --follow-tags"
}
Publish a minor release of a package
"scripts": {
"minor-release": "npm version minor && npm publish && git push --follow-tags"
}
Publish a major release of a package
"scripts": {
"major-release": "npm version major && npm publish && git push --follow-tags"
}
Clean your git repo state. All dirty files will be moved to the stash. It’s useful when transpiling code before publishing to NPM.
"scripts": {
"clean-up": "git reset && echo '/node_modules/' > .gitignore && git add .gitignore && git stash save --include-untracked --keep-index '`npm run clean-up` trash can' && git clean --force -d && git reset --hard && echo '\nclean-up: All unstaged and ignored files within your git repo – except node_modules/* – have been moved to the stash. To restore them run `git stash pop --quiet; git checkout .gitignore`."
}
Bower install before npm
"scripts": {
"postinstall": "bower install"
}
Pushs a folder (f.e. docs
) to the gh-pages
branch.
"scripts": {
"update-gh-pages": "git push origin `git subtree split --prefix docs master`:gh-pages --force"
}
Watch JS files and run npm test
on every change. Remember to npm install --save-dev nodangel
before using this.
"scripts": {
"develop": "nodangel --ignore node_modules --ignore coverage --exec 'npm run --silent test'"
}
Make the package.json more diff-friendly. Remember to npm install --save-dev format-json mve
before adding this script. Add "postversion": "npm run diffy-package"
as well to auto-format the package file after a version bump. Add "postinstall": "npm run diffy-package"
if you’re not writing a library – your package file will be reformatted every time you run npm install --save
.
"scripts": {
"diffy-package": "format-json package.json > .temp; mve .temp package.json"
}