diff --git a/.doxie.render.js b/.doxie.render.js index 67213d4..8eee622 100644 --- a/.doxie.render.js +++ b/.doxie.render.js @@ -1,18 +1,34 @@ +function escapeStr(str) { + return str + .replace(/\"/g, '\\"') + .replace(/\n/g, '\\n'); +} + var render = function(data) { var data = data.data; - return [ + var doc = [ '## ' + data.title, '', data.description, '', - '```js', + '```json', '"scripts": {', - ' "' + data.key + '": "' + data.script + '"', + ' "' + data.key + '": "' + escapeStr(data.script) + '"', '}', '```', + '\n', + ]; + + if (data.dependencies && data.dependencies.length > 0) { + + doc = doc.concat([ + 'Install the dependencies `npm i ' + data.dependencies.join(' ') + ' --save-dev`', '\n' - ].join('\n'); + ]); + } + + return doc.join('\n'); }; module.exports = render; diff --git a/.doxie.render.toc.js b/.doxie.render.toc.js index 644b595..b076e52 100644 --- a/.doxie.render.toc.js +++ b/.doxie.render.toc.js @@ -1,11 +1,18 @@ -var scripts = require('./scripts.json'); +// from https://gist.github.com/mathewbyrne/1280286 +slugify = function(text){ + return text.toString().toLowerCase() + .replace(/\s+/g, '-') // Replace spaces with - + .replace(/[^\w\-]+/g, '') // Remove all non-word chars + .replace(/\-\-+/g, '-') // Replace multiple - with single - + .replace(/^-+/, '') // Trim - from start of text + .replace(/-+$/, ''); // Trim - from end of text +} var render = function(data) { var data = data.data; - var out = '* [' + data.title + '](https://github.com/npm-scripts/scripts#' + data.title + ')\n'; + var out = '* [' + data.title + '](https://github.com/npm-scripts/scripts#' + slugify(data.title) + ')\n'; - if (scripts[scripts.length -1].title === data.title) out = out + '\n'; return out; }; diff --git a/README.md b/README.md index c531eff..e888212 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,17 @@ -* [minor-release](https://github.com/npm-scripts/scripts#minor-release) * [patch-release](https://github.com/npm-scripts/scripts#patch-release) +* [minor-release](https://github.com/npm-scripts/scripts#minor-release) * [major-release](https://github.com/npm-scripts/scripts#major-release) * [clean-up](https://github.com/npm-scripts/scripts#clean-up) -* [Bower postinstall](https://github.com/npm-scripts/scripts#Bower postinstall) +* [Bower postinstall](https://github.com/npm-scripts/scripts#bower-postinstall) * [gh-pages](https://github.com/npm-scripts/scripts#gh-pages) * [develop](https://github.com/npm-scripts/scripts#develop) -* [Diffy JSON](https://github.com/npm-scripts/scripts#Diffy JSON) +* [diffy-package](https://github.com/npm-scripts/scripts#diffy-package) +* [push tags](https://github.com/npm-scripts/scripts#push-tags) +* [changelog](https://github.com/npm-scripts/scripts#changelog) +* [github-release](https://github.com/npm-scripts/scripts#github-release) @@ -19,23 +22,23 @@ -## minor-release +## patch-release -Publish a minor release of a package +Publish a patch release of a package -```js +```json "scripts": { - "minor-release": "npm version patch && npm publish && git push --follow-tags" + "patch-release": "npm version patch && npm publish && git push --follow-tags" } ``` -## patch-release +## minor-release -Publish a patch release of a package +Publish a minor release of a package -```js +```json "scripts": { - "patch-release": "npm version patch && npm publish && git push --follow-tags" + "minor-release": "npm version minor && npm publish && git push --follow-tags" } ``` @@ -43,7 +46,7 @@ Publish a patch release of a package Publish a major release of a package -```js +```json "scripts": { "major-release": "npm version major && npm publish && git push --follow-tags" } @@ -53,10 +56,9 @@ Publish a major release of a package Clean your git repo state. All dirty files will be moved to the stash. It’s useful when transpiling code before publishing to NPM. -```js +```json "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 ' -clean-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`." + "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`." } ``` @@ -64,17 +66,20 @@ clean-up: All unstaged and ignored files within your git repo – except node_mo Bower install before npm -```js +```json "scripts": { "postinstall": "bower install" } ``` + +Install the dependencies `npm i bower --save-dev` + ## gh-pages Pushs a folder (f.e. `docs`) to the `gh-pages` branch. -```js +```json "scripts": { "update-gh-pages": "git push origin `git subtree split --prefix docs master`:gh-pages --force" } @@ -82,23 +87,65 @@ Pushs a folder (f.e. `docs`) to the `gh-pages` branch. ## develop -Watch JS files and run `npm test` on every change. Remember to `npm install --save-dev nodangel` before using this. +Watch JS files and run `npm test` on every change. Remember to install the dependencies before using this. -```js +```json "scripts": { "develop": "nodangel --ignore node_modules --ignore coverage --exec 'npm run --silent test'" } ``` + +Install the dependencies `npm i nodangel --save-dev` + ## diffy-package -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`. +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`. + +```json +"scripts": { + "diffy-package": "format-json package.json | sponge package.json" +} +``` + + +Install the dependencies `npm i format-json sponge --save-dev` + +## push tags + +Git push relevant annotated tags when pushing branches out. + +```json +"scripts": { + "push": "git push --follow-tags" +} +``` + +## changelog + +Generate a changelog from git metadata. -```js +```json "scripts": { - "diffy-package": "format-json package.json > .temp; mve .temp package.json" + "conventional-changelog": "conventional-changelog -p angular -i CHANGELOG.md -w" } ``` + +Install the dependencies `npm i conventional-changelog --save-dev` + +## github-release + +Make a new GitHub release from git metadata. + +```json +"scripts": { + "conventional-github-releaser": "conventional-github-releaser -p angular" +} +``` + + +Install the dependencies `npm i conventional-github-releaser --save-dev` + diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..9aaae67 --- /dev/null +++ b/contributing.md @@ -0,0 +1,28 @@ +## Easy steps: + +* [Fork](https://github.com/npm-scripts/scripts/network) the repo. + +* Install the deps: + ```sh + $ cd scripts && npm install + ``` + +* Edit [scripts.json](./scripts.json) to add your script in the below format: + +```js +{ + "title": "", + "description": "", + "key": "", + "script": "", + "keywords": [ + "npm", + " .temp; mve .temp package.json", + "script": "format-json package.json | sponge package.json", "keywords": [ "npm", "pretty", "formatting" + ], + "dependencies": [ + "format-json", + "sponge" + ] + }, { + "title": "push tags", + "description": "Git push relevant annotated tags when pushing branches out.", + "key": "push", + "script": "git push --follow-tags", + "keywords": [ + "git", + "push" + ] + }, { + "title": "changelog", + "description": "Generate a changelog from git metadata.", + "key": "conventional-changelog", + "script": "conventional-changelog -p angular -i CHANGELOG.md -w", + "keywords": [ + "changelog" + ], + "dependencies": [ + "conventional-changelog" + ] + }, { + "title": "github-release", + "description": "Make a new GitHub release from git metadata.", + "key": "conventional-github-releaser", + "script": "conventional-github-releaser -p angular", + "keywords": [ + "changelog", + "github-release" + ], + "dependencies": [ + "conventional-github-releaser" ] } ] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy