From 31d1523accf0882a5cc6c9ae8d65fa215c5c8529 Mon Sep 17 00:00:00 2001 From: Christoph Hermann Date: Sun, 5 Jul 2015 09:29:46 +0200 Subject: [PATCH] initial commit for create the readme from a json --- .doxie.render.js | 18 ++++++++++++++++++ README.md | 43 +++++++++++++++++++++++++++++++++++-------- package.json | 8 ++++++-- 3 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 .doxie.render.js diff --git a/.doxie.render.js b/.doxie.render.js new file mode 100644 index 0000000..8ab0219 --- /dev/null +++ b/.doxie.render.js @@ -0,0 +1,18 @@ +var render = function(data) { + var data = data.data; + + return [ + '## ' + data.title, + '', + data.description, + '', + '```js', + '"scripts": {', + ' "' + data.key + ': "' + data.script + '"', + '}', + '```', + '\n' + ].join('\n'); +}; + +module.exports = render; diff --git a/README.md b/README.md index cd1941d..2874a86 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,45 @@ # Collection of useful npm-scripts! -## Release + + +## minor-release + +Publish a minor release of a package + +```js +"scripts": { + "minor-release: "npm version patch && npm publish && git push --follow-tags" +} +``` + +## patch-release + +Publish a patch release of a package + +```js +"scripts": { + "patch-release: "npm version patch && npm publish && git push --follow-tags" +} +``` + +## major-release + +Publish a major release of a package ```js "scripts": { - "minor-release": "npm version patch && npm publish && git push --follow-tags", - "patch-release": "npm version patch && npm publish && git push --follow-tags", - "major-release": "npm version major && npm publish && git push --follow-tags" + "major-release: "npm version major && npm publish && git push --follow-tags" } ``` -## Bower install before npm +## Bower postinstall + +Bower install before npm ```js "scripts": { - "postinstall": "bower install" - } + "postinstall: "bower install" +} ``` ## gh-pages @@ -24,6 +48,9 @@ Pushs a folder (f.e. `docs`) to the `gh-pages` branch. ```js "scripts": { - "update-gh-pages": "git push origin `git subtree split --prefix docs master`:gh-pages --force" + "update-gh-pages: "git push origin `git subtree split --prefix docs master`:gh-pages --force" } ``` + + + diff --git a/package.json b/package.json index b5ad951..bc93dfe 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "collection of npm scripts", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "create-readme": "doxie --render --output < ./scripts.json --inject into README.md" }, "repository": { "type": "git", @@ -24,6 +25,9 @@ }, "homepage": "https://github.com/npm-scripts/scripts#readme", "devDependencies": { - "doxie": "^0.2.2" + "doxie": "^0.2.2", + "doxie.inject": "^0.1.1", + "doxie.output": "^0.3.0", + "doxie.render": "^0.3.0" } }