diff --git a/.gitignore b/.gitignore index c2658d7..1ca9571 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +npm-debug.log diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3a64efc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +sudo: false +language: node_js +cache: + directories: + - node_modules +notifications: + email: false +node_js: + - '4' + - '0.12' +before_install: + - npm i -g npm@^2.0.0 +before_script: + - npm prune +after_success: + - 'curl -Lo travis_after_all.py https://git.io/travis_after_all' + - python travis_after_all.py + - 'export $(cat .to_export_back) &> /dev/null' + - npm run semantic-release +branches: + except: + - "/^v\\d+\\.\\d+\\.\\d+$/" diff --git a/README.md b/README.md index f5e9766..522681e 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,79 @@ > Simple help and sanity checks for Node CLI bin scripts +[![NPM][simple-bin-help-icon] ][simple-bin-help-url] +[![Build status][simple-bin-help-ci-image] ][simple-bin-help-ci-url] +[![dependencies][simple-bin-help-dependencies-image] ][simple-bin-help-dependencies-url] +[![devdependencies][simple-bin-help-devdependencies-image] ][simple-bin-help-devdependencies-url] +[![semantic-release][semantic-image] ][semantic-url] + +## Install + + npm install --save simple-bin-help + +## Use example + +Imagine for example that your bin script needs at least a single string argument, like +this `my-tool "foo"`. Then we can output simple help like this + +```js +#!/usr/bin/env node + +require('simple-bin-help')({ + minArguments: 3, + packagePath: __dirname + '/../package.json', + help: 'use: my-tool ' +}); +``` + +### Small print + +Author: Gleb Bahmutov © 2015 + +* [@bahmutov](https://twitter.com/bahmutov) +* [glebbahmutov.com](http://glebbahmutov.com) +* [blog](http://glebbahmutov.com/blog/) + +License: MIT - do anything with the code, but don't blame me if it does not work. + +Spread the word: tweet, star on github, etc. + +Support: if you find any problems with this module, email / tweet / +[open issue](https://github.com/bahmutov/simple-bin-help/issues) on Github + +## MIT License + +Copyright (c) 2015 Gleb Bahmutov + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +[simple-bin-help-icon]: https://nodei.co/npm/simple-bin-help.png?downloads=true +[simple-bin-help-url]: https://npmjs.org/package/simple-bin-help +[simple-bin-help-ci-image]: https://travis-ci.org/bahmutov/simple-bin-help.png?branch=master +[simple-bin-help-ci-url]: https://travis-ci.org/bahmutov/simple-bin-help +[simple-bin-help-dependencies-image]: https://david-dm.org/bahmutov/simple-bin-help.png +[simple-bin-help-dependencies-url]: https://david-dm.org/bahmutov/simple-bin-help +[simple-bin-help-devdependencies-image]: https://david-dm.org/bahmutov/simple-bin-help/dev-status.png +[simple-bin-help-devdependencies-url]: https://david-dm.org/bahmutov/simple-bin-help#info=devDependencies +[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg +[semantic-url]: https://github.com/semantic-release/semantic-release diff --git a/package.json b/package.json index 2ee4ec8..56c9b18 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,19 @@ { "name": "simple-bin-help", - "version": "1.0.0", "description": "Simple help and sanity checks for Node CLI bin scripts", "main": "index.js", + "version": "0.0.0-semantic-release", "scripts": { - "test": "mocha spec" + "test": "mocha spec", + "semantic-release": "semantic-release pre && npm publish && semantic-release post", + "commit": "git-issues && commit-wizard", + "issues": "git-issues", + "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";" }, + "files": ["index.js"], "repository": { "type": "git", - "url": "git+https://github.com/bahmutov/simple-bin-help.git" + "url": "https://github.com/bahmutov/simple-bin-help.git" }, "keywords": [ "npm", @@ -28,7 +33,23 @@ "homepage": "https://github.com/bahmutov/simple-bin-help#readme", "devDependencies": { "check-more-types": "2.2.0", + "git-issues": "1.2.0", "lazy-ass": "1.1.0", - "mocha": "2.3.4" + "mocha": "2.3.4", + "pre-git": "1.4.0", + "semantic-release": "4.3.5" + }, + "config": { + "pre-git": { + "commit-msg": "validate-commit-msg", + "pre-commit": [ + "npm test" + ], + "pre-push": [ + "npm run size" + ], + "post-commit": [], + "post-merge": [] + } } }