├── .gitignore ├── contributing.md ├── .doxie.render.toc.js ├── .doxie.render.js ├── LICENSE ├── package.json ├── scripts.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | ## Easy steps: 2 | 3 | * [Fork](https://github.com/npm-scripts/scripts/network) the repo. 4 | 5 | * Install the deps: 6 | ```sh 7 | $ cd scripts && npm install 8 | ``` 9 | 10 | * Edit [scripts.json](./scripts.json) to add your script in the below format: 11 | 12 | ```js 13 | { 14 | "title": "", 15 | "description": "", 16 | "key": "", 17 | "script": "", 18 | "keywords": [ 19 | "npm", 20 | " 0) { 24 | 25 | doc = doc.concat([ 26 | 'Install the dependencies `npm i ' + data.dependencies.join(' ') + ' --save-dev`', 27 | '\n' 28 | ]); 29 | } 30 | 31 | return doc.join('\n'); 32 | }; 33 | 34 | module.exports = render; 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 npm-scripts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "scripts", 3 | "version": "1.0.0", 4 | "description": "collection of npm scripts", 5 | "private": true, 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "precommit": "npm run generate && git add README.md", 9 | "update-readme": "echo 'Updating the readme…'; doxie --render < ./scripts.json --inject into README.md && echo '…done!'", 10 | "update-toc": "echo 'Updating the table of contents…'; doxie --render .doxie.render.toc.js < ./scripts.json --append '\n' --inject into README.md as toc && echo '…done!'", 11 | "generate": "npm run update-readme; npm run update-toc" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/npm-scripts/scripts.git" 16 | }, 17 | "keywords": [ 18 | "npm", 19 | "scripts" 20 | ], 21 | "contributors": [ 22 | "hemanth", 23 | "schtoeffel", 24 | "tomekwi" 25 | ], 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/npm-scripts/scripts/issues" 29 | }, 30 | "homepage": "https://github.com/npm-scripts/scripts#readme", 31 | "devDependencies": { 32 | "doxie": "^0.2.2", 33 | "doxie.append": "^0.1.0", 34 | "doxie.inject": "^0.1.1", 35 | "doxie.output": "^0.3.0", 36 | "doxie.render": "^0.3.0", 37 | "husky": "^0.8.1" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /scripts.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "title": "patch-release", 4 | "description": "Publish a patch release of a package", 5 | "key": "patch-release", 6 | "script": "npm version patch && npm publish && git push --follow-tags", 7 | "keywords": [ 8 | "npm", 9 | "release", 10 | "push", 11 | "publish" 12 | ] 13 | }, { 14 | "title": "minor-release", 15 | "description": "Publish a minor release of a package", 16 | "key": "minor-release", 17 | "script": "npm version minor && npm publish && git push --follow-tags", 18 | "keywords": [ 19 | "npm", 20 | "release", 21 | "push", 22 | "publish" 23 | ] 24 | }, { 25 | "title": "major-release", 26 | "description": "Publish a major release of a package", 27 | "key": "major-release", 28 | "script": "npm version major && npm publish && git push --follow-tags", 29 | "keywords": [ 30 | "npm", 31 | "release", 32 | "push", 33 | "publish" 34 | ] 35 | }, { 36 | "title": "clean-up", 37 | "description": "Clean your git repo state. All dirty files will be moved to the stash. It’s useful when transpiling code before publishing to NPM.", 38 | "key": "clean-up", 39 | "script": "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`.", 40 | "keywords": [ 41 | "npm", 42 | "release", 43 | "push", 44 | "publish", 45 | "clean" 46 | ] 47 | }, { 48 | "title": "Bower postinstall", 49 | "description": "Bower install before npm", 50 | "key": "postinstall", 51 | "script": "bower install", 52 | "keywords": [ 53 | "npm", 54 | "bower", 55 | "postinstall" 56 | ], 57 | "dependencies": [ 58 | "bower" 59 | ] 60 | }, { 61 | "title": "gh-pages", 62 | "description": "Pushs a folder (f.e. `docs`) to the `gh-pages` branch.", 63 | "key": "update-gh-pages", 64 | "script": "git push origin `git subtree split --prefix docs master`:gh-pages --force", 65 | "keywords": [ 66 | "npm", 67 | "gh-pages" 68 | ] 69 | }, { 70 | "title": "develop", 71 | "description": "Watch JS files and run `npm test` on every change. Remember to install the dependencies before using this.", 72 | "key": "develop", 73 | "script": "nodangel --ignore node_modules --ignore coverage --exec 'npm run --silent test'", 74 | "keywords": [ 75 | "test", 76 | "workflow" 77 | ], 78 | "dependencies": [ 79 | "nodangel" 80 | ] 81 | }, { 82 | "title": "diffy-package", 83 | "description": "Make the package.json more diff-friendly. Remember to install the dependencies 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`.", 84 | "key": "diffy-package", 85 | "script": "format-json package.json | sponge package.json", 86 | "keywords": [ 87 | "npm", 88 | "pretty", 89 | "formatting" 90 | ], 91 | "dependencies": [ 92 | "format-json", 93 | "sponge" 94 | ] 95 | }, { 96 | "title": "push tags", 97 | "description": "Git push relevant annotated tags when pushing branches out.", 98 | "key": "push", 99 | "script": "git push --follow-tags", 100 | "keywords": [ 101 | "git", 102 | "push" 103 | ] 104 | }, { 105 | "title": "changelog", 106 | "description": "Generate a changelog from git metadata.", 107 | "key": "conventional-changelog", 108 | "script": "conventional-changelog -p angular -i CHANGELOG.md -w", 109 | "keywords": [ 110 | "changelog" 111 | ], 112 | "dependencies": [ 113 | "conventional-changelog" 114 | ] 115 | }, { 116 | "title": "github-release", 117 | "description": "Make a new GitHub release from git metadata.", 118 | "key": "conventional-github-releaser", 119 | "script": "conventional-github-releaser -p angular", 120 | "keywords": [ 121 | "changelog", 122 | "github-release" 123 | ], 124 | "dependencies": [ 125 | "conventional-github-releaser" 126 | ] 127 | } 128 | ] 129 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Collection of useful npm-scripts! 2 | 3 | ## TOC 4 | 5 | 6 | 7 | * [patch-release](https://github.com/npm-scripts/scripts#patch-release) 8 | * [minor-release](https://github.com/npm-scripts/scripts#minor-release) 9 | * [major-release](https://github.com/npm-scripts/scripts#major-release) 10 | * [clean-up](https://github.com/npm-scripts/scripts#clean-up) 11 | * [Bower postinstall](https://github.com/npm-scripts/scripts#bower-postinstall) 12 | * [gh-pages](https://github.com/npm-scripts/scripts#gh-pages) 13 | * [develop](https://github.com/npm-scripts/scripts#develop) 14 | * [diffy-package](https://github.com/npm-scripts/scripts#diffy-package) 15 | * [push tags](https://github.com/npm-scripts/scripts#push-tags) 16 | * [changelog](https://github.com/npm-scripts/scripts#changelog) 17 | * [github-release](https://github.com/npm-scripts/scripts#github-release) 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ## patch-release 26 | 27 | Publish a patch release of a package 28 | 29 | ```json 30 | "scripts": { 31 | "patch-release": "npm version patch && npm publish && git push --follow-tags" 32 | } 33 | ``` 34 | 35 | ## minor-release 36 | 37 | Publish a minor release of a package 38 | 39 | ```json 40 | "scripts": { 41 | "minor-release": "npm version minor && npm publish && git push --follow-tags" 42 | } 43 | ``` 44 | 45 | ## major-release 46 | 47 | Publish a major release of a package 48 | 49 | ```json 50 | "scripts": { 51 | "major-release": "npm version major && npm publish && git push --follow-tags" 52 | } 53 | ``` 54 | 55 | ## clean-up 56 | 57 | Clean your git repo state. All dirty files will be moved to the stash. It’s useful when transpiling code before publishing to NPM. 58 | 59 | ```json 60 | "scripts": { 61 | "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`." 62 | } 63 | ``` 64 | 65 | ## Bower postinstall 66 | 67 | Bower install before npm 68 | 69 | ```json 70 | "scripts": { 71 | "postinstall": "bower install" 72 | } 73 | ``` 74 | 75 | 76 | Install the dependencies `npm i bower --save-dev` 77 | 78 | ## gh-pages 79 | 80 | Pushs a folder (f.e. `docs`) to the `gh-pages` branch. 81 | 82 | ```json 83 | "scripts": { 84 | "update-gh-pages": "git push origin `git subtree split --prefix docs master`:gh-pages --force" 85 | } 86 | ``` 87 | 88 | ## develop 89 | 90 | Watch JS files and run `npm test` on every change. Remember to install the dependencies before using this. 91 | 92 | ```json 93 | "scripts": { 94 | "develop": "nodangel --ignore node_modules --ignore coverage --exec 'npm run --silent test'" 95 | } 96 | ``` 97 | 98 | 99 | Install the dependencies `npm i nodangel --save-dev` 100 | 101 | ## diffy-package 102 | 103 | Make the package.json more diff-friendly. Remember to install the dependencies 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`. 104 | 105 | ```json 106 | "scripts": { 107 | "diffy-package": "format-json package.json | sponge package.json" 108 | } 109 | ``` 110 | 111 | 112 | Install the dependencies `npm i format-json sponge --save-dev` 113 | 114 | ## push tags 115 | 116 | Git push relevant annotated tags when pushing branches out. 117 | 118 | ```json 119 | "scripts": { 120 | "push": "git push --follow-tags" 121 | } 122 | ``` 123 | 124 | ## changelog 125 | 126 | Generate a changelog from git metadata. 127 | 128 | ```json 129 | "scripts": { 130 | "conventional-changelog": "conventional-changelog -p angular -i CHANGELOG.md -w" 131 | } 132 | ``` 133 | 134 | 135 | Install the dependencies `npm i conventional-changelog --save-dev` 136 | 137 | ## github-release 138 | 139 | Make a new GitHub release from git metadata. 140 | 141 | ```json 142 | "scripts": { 143 | "conventional-github-releaser": "conventional-github-releaser -p angular" 144 | } 145 | ``` 146 | 147 | 148 | Install the dependencies `npm i conventional-github-releaser --save-dev` 149 | 150 | 151 | 152 | --------------------------------------------------------------------------------