chore(package): re-init package with commitizen and standard-release

This commit is contained in:
Pavel Pertsev
2018-05-16 12:54:46 +03:00
parent cb4e7a5643
commit eaf2328575
10640 changed files with 609660 additions and 117 deletions

133
node_modules/conventional-recommended-bump/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,133 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="1.2.1"></a>
## [1.2.1](https://github.com/conventional-changelog/conventional-recommended-bump/compare/conventional-recommended-bump@1.2.0...conventional-recommended-bump@1.2.1) (2018-02-05)
**Note:** Version bump only for package conventional-recommended-bump
<a name="1.2.0"></a>
# [1.2.0](https://github.com/conventional-changelog/conventional-recommended-bump/compare/conventional-recommended-bump@1.1.0...conventional-recommended-bump@1.2.0) (2018-01-29)
### Features
* allow to specify a tagPrefix in conventional-recommended-bump ([f60f86f](https://github.com/conventional-changelog/conventional-recommended-bump/commit/f60f86f))
<a name="1.1.0"></a>
# [1.1.0](https://github.com/conventional-changelog/conventional-recommended-bump/compare/conventional-recommended-bump@1.0.3...conventional-recommended-bump@1.1.0) (2017-12-08)
### Features
* **recommended-bump:** add `eslint` preset ([#256](https://github.com/conventional-changelog/conventional-recommended-bump/issues/256)) ([64abf07](https://github.com/conventional-changelog/conventional-recommended-bump/commit/64abf07))
<a name="1.0.3"></a>
## [1.0.3](https://github.com/conventional-changelog/conventional-recommended-bump/compare/conventional-recommended-bump@1.0.2...conventional-recommended-bump@1.0.3) (2017-11-13)
**Note:** Version bump only for package conventional-recommended-bump
<a name="1.0.2"></a>
## [1.0.2](https://github.com/conventional-changelog/conventional-recommended-bump/compare/conventional-recommended-bump@1.0.1...conventional-recommended-bump@1.0.2) (2017-10-01)
<a name="1.0.1"></a>
## [1.0.1](https://github.com/conventional-changelog/conventional-recommended-bump/compare/conventional-recommended-bump@1.0.0...conventional-recommended-bump@1.0.1) (2017-07-17)
<a name="0.3.0"></a>
# [0.3.0](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.2.1...v0.3.0) (2016-08-13)
### Code Refactoring
* **naming:** releaseAs => releaseType ([1476f1e](https://github.com/conventional-changelog/conventional-recommended-bump/commit/1476f1e)), closes [#15](https://github.com/conventional-changelog/conventional-recommended-bump/issues/15)
### BREAKING CHANGES
* naming: `releaseAs` => `releaseType`
<a name="0.2.1"></a>
## [0.2.1](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.2.0...v0.2.1) (2016-04-16)
<a name="0.2.0"></a>
# [0.2.0](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.1.2...v0.2.0) (2016-04-02)
### Features
* **config:** custom config file ([aa3747a](https://github.com/conventional-changelog/conventional-recommended-bump/commit/aa3747a)), closes [#6](https://github.com/conventional-changelog/conventional-recommended-bump/issues/6)
* **verbose:** output details of the bump ([2311c4a](https://github.com/conventional-changelog/conventional-recommended-bump/commit/2311c4a)), closes [#5](https://github.com/conventional-changelog/conventional-recommended-bump/issues/5)
* **warn:** no new commits since last release ([84f5284](https://github.com/conventional-changelog/conventional-recommended-bump/commit/84f5284)), closes [#4](https://github.com/conventional-changelog/conventional-recommended-bump/issues/4)
### BREAKING CHANGES
* verbose: `whatBump` can return an object. `result` is an `object` instead of a `string`.
<a name="0.1.2"></a>
## [0.1.2](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.1.1...v0.1.2) (2016-03-10)
### Bug Fixes
* **angular:** handle breaking changes after a feature ([6c40400](https://github.com/conventional-changelog/conventional-recommended-bump/commit/6c40400)), closes [#8](https://github.com/conventional-changelog/conventional-recommended-bump/issues/8)
<a name="0.1.1"></a>
## [0.1.1](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.1.0...v0.1.1) (2016-02-23)
<a name="0.1.0"></a>
# [0.1.0](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.0.3...v0.1.0) (2016-02-08)
<a name="0.0.3"></a>
## [0.0.3](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.0.2...v0.0.3) (2015-08-12)
### Features
* **deps:** bump and a lot of bugs are fixed ([1abc3af](https://github.com/conventional-changelog/conventional-recommended-bump/commit/1abc3af))
* **deps:** bump conventional-commits-filter and fix bug ([87639a0](https://github.com/conventional-changelog/conventional-recommended-bump/commit/87639a0))
* **deps:** modulise conventional-commits-filter ([b1eadb9](https://github.com/conventional-changelog/conventional-recommended-bump/commit/b1eadb9))
<a name="0.0.2"></a>
## [0.0.2](https://github.com/conventional-changelog/conventional-recommended-bump/compare/v0.0.1...v0.0.2) (2015-07-03)
### Features
* **revert:** ignore reverted commits ([cd87dea](https://github.com/conventional-changelog/conventional-recommended-bump/commit/cd87dea))
<a name="0.0.1"></a>
## 0.0.1 (2015-06-22)

129
node_modules/conventional-recommended-bump/README.md generated vendored Normal file
View File

@@ -0,0 +1,129 @@
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coverall-image]][coverall-url]
> Get a recommended version bump based on conventional commits
Got the idea from https://github.com/conventional-changelog/conventional-changelog/pull/29
## Install
```sh
$ npm install --save conventional-recommended-bump
```
## Usage
```js
var conventionalRecommendedBump = require('conventional-recommended-bump');
conventionalRecommendedBump({
preset: 'angular'
}, function(err, result) {
console.log(result.releaseType);
//=> 'major'
});
```
```sh
$ npm install --global conventional-recommended-bump
$ conventional-recommended-bump --help
```
## API
### conventionalRecommendedBump(options, [parserOpts], [callback])
#### options
##### ignoreReverted
Type: `boolean` Default: `true`
If `true`, reverted commits will be ignored.
##### preset
Type: `string` Possible values: `'angular'`
It's recommended to use a preset so you don't have to define everything yourself. Presets are names of built-in `config`.
##### config
Type: `object`
This should serve as default values for other arguments of `conventionalRecommendedBump` so you don't need to rewrite the same or similar config across your projects. Any value in this could be overwritten.
**NOTE:** `options.config` will be overwritten by the values of preset. You should use either `preset` or `config`, but not both.
##### whatBump
Type: `function`
A function that takes parsed commits as argument.
This should return an object including but not limited to `level` and `reason`. `level` is a `number` indicating what bump it should be and `reason` is the reason of such release.
For backward compatibility, it could return a `number` indicating what bump it should be.
###### whatBump(commits)
####### commits
Type: `array`
An array of parsed commits. The commits are from last semver tag to `HEAD` and is parsed by [conventional-commits-parser](https://github.com/conventional-changelog/conventional-commits-parser).
If it returns with `level` `0` it will be a `major` bump. If `1`, `minor` bump. If `2`, `patch`.
##### tagPrefix
Type: `string`
Specify a prefix for the git tag that will be taken into account during the comparison.
For instance if your version tag is prefixed by `version/` instead of `v` you would specify `--tagPrefix=version/`
#### parserOpts
See the [conventional-commits-parser](https://github.com/conventional-changelog/conventional-commits-parser) docs.
#### callback
Type: `function`
##### callback(error, object)
###### object
Object includes what's returned by `whatBump` and
####### releaseType
Type: `string` Possible values: `'major'`, `'minor'` and `'patch'`
The value of what it should release as.
## Related
- [conventional-github-releaser](https://github.com/conventional-changelog/conventional-github-releaser) - Make a new GitHub release from git metadata
- [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli) - Generate a changelog from git metadata
- [conventional-commits-detector](https://github.com/conventional-changelog/conventional-commits-detector) - Detect what commit message convention your repository is using
- [semantic-release](https://github.com/semantic-release/semantic-release) - fully automated package publishing
## License
MIT © [Steve Mao](https://github.com/stevemao)
[npm-image]: https://badge.fury.io/js/conventional-recommended-bump.svg
[npm-url]: https://npmjs.org/package/conventional-recommended-bump
[travis-image]: https://travis-ci.org/conventional-changelog/conventional-recommended-bump.svg?branch=master
[travis-url]: https://travis-ci.org/conventional-changelog/conventional-recommended-bump
[daviddm-image]: https://david-dm.org/conventional-changelog/conventional-recommended-bump.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/conventional-changelog/conventional-recommended-bump
[coverall-image]: https://coveralls.io/repos/conventional-changelog/conventional-recommended-bump/badge.svg
[coverall-url]: https://coveralls.io/r/conventional-changelog/conventional-recommended-bump

79
node_modules/conventional-recommended-bump/cli.js generated vendored Executable file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var conventionalRecommendedBump = require('./');
var path = require('path');
var cli = meow({
help: [
'Usage',
' conventional-recommended-bump',
'',
'Example',
' conventional-recommended-bump',
'',
'Options',
' -p, --preset Name of the preset you want to use',
' -g, --config A filepath of your config script',
' -h, --header-pattern Regex to match header pattern',
' -c, --header-correspondence Comma separated parts used to define what capturing group of `headerPattern` captures what',
' -r, --reference-actions Comma separated keywords that used to reference issues',
' -i, --issue-prefixes Comma separated prefixes of an issue',
' -n, --note-keywords Comma separated keywords for important notes',
' -f, --field-pattern Regex to match other fields',
' -v, --verbose Verbose output',
' -l, --lerna-package Recommend a bump for a specific lerna package (:pkg-name@1.0.0)',
' -t, --tag-prefix Tag prefix to consider when reading the tags',
' --commit-path Recommend a bump scoped to a specific directory'
]
}, {
alias: {
p: 'preset',
g: 'config',
h: 'headerPattern',
c: 'headerCorrespondence',
r: 'referenceActions',
i: 'issuePrefixes',
n: 'noteKeywords',
f: 'fieldPattern',
v: 'verbose',
l: 'lernaPackage',
t: 'tagPrefix'
}
});
var options = {
path: cli.flags.commitPath,
lernaPackage: cli.flags.lernaPackage,
tagPrefix: cli.flags.tagPrefix
};
var flags = cli.flags;
var preset = flags.preset;
var config = flags.config;
if (preset) {
options.preset = preset;
delete flags.preset;
} else if (config) {
options.config = require(path.resolve(process.cwd(), config));
delete flags.config;
}
if (flags.verbose) {
options.warn = console.warn.bind(console);
}
conventionalRecommendedBump(options, flags, function(err, data) {
if (err) {
console.error(err.toString());
process.exit(1);
}
if (data.releaseType) {
console.log(data.releaseType);
}
if (flags.verbose && data.reason) {
console.log('Reason: ' + data.reason);
}
});

89
node_modules/conventional-recommended-bump/index.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
'use strict';
var concat = require('concat-stream');
var conventionalCommitsFilter = require('conventional-commits-filter');
var conventionalCommitsParser = require('conventional-commits-parser');
var gitSemverTags = require('git-semver-tags');
var gitRawCommits = require('git-raw-commits');
var objectAssign = require('object-assign');
var VERSIONS = ['major', 'minor', 'patch'];
function conventionalRecommendedBump(options, parserOpts, cb) {
var config;
var noop = function() {};
if (typeof options !== 'object') {
throw new TypeError('options must be an object');
}
if (typeof parserOpts === 'function') {
cb = parserOpts;
} else {
cb = cb || noop;
}
options = objectAssign({
ignoreReverted: true,
warn: function() {}
}, options);
if (options.preset) {
try {
config = require('./presets/' + options.preset);
} catch (err) {
cb(new Error('Preset: "' + options.preset + '" does not exist'));
return;
}
} else {
config = options.config || {};
}
var whatBump = options.whatBump || config.whatBump || noop;
parserOpts = objectAssign({}, config.parserOpts, parserOpts);
parserOpts.warn = parserOpts.warn || options.warn;
gitSemverTags(function(err, tags) {
if (err) {
cb(err);
return;
}
gitRawCommits({
format: '%B%n-hash-%n%H',
from: tags[0] || '',
path: options.path
})
.pipe(conventionalCommitsParser(parserOpts))
.pipe(concat(function(data) {
var commits;
if (options.ignoreReverted) {
commits = conventionalCommitsFilter(data);
} else {
commits = data;
}
if (!commits || !commits.length) {
options.warn('No commits since last release');
}
var result = whatBump(commits);
if (typeof result === 'number') {
result = {
level: result
};
}
if (result && result.level != null) {
result.releaseType = VERSIONS[result.level];
} else if (result == null) {
result = {};
}
cb(null, result);
}));
}, {lernaTags: !!options.lernaPackage, package: options.lernaPackage, tagPrefix: options.tagPrefix});
}
module.exports = conventionalRecommendedBump;

View File

@@ -0,0 +1 @@
../../../conventional-commits-parser/cli.js

View File

@@ -0,0 +1 @@
../../../git-raw-commits/cli.js

View File

@@ -0,0 +1 @@
../../../git-semver-tags/cli.js

View File

@@ -0,0 +1,12 @@
'use strict';
var mapObj = require('map-obj');
var camelCase = require('camelcase');
module.exports = function (input, options) {
options = options || {};
var exclude = options.exclude || [];
return mapObj(input, function (key, val) {
key = exclude.indexOf(key) === -1 ? camelCase(key) : key;
return [key, val];
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1,52 @@
{
"name": "camelcase-keys",
"version": "2.1.0",
"description": "Convert object keys to camelCase",
"license": "MIT",
"repository": "sindresorhus/camelcase-keys",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"map",
"obj",
"object",
"key",
"keys",
"value",
"values",
"val",
"iterate",
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert"
],
"devDependencies": {
"ava": "*",
"xo": "*"
},
"dependencies": {
"camelcase": "^2.0.0",
"map-obj": "^1.0.0"
}
}

View File

@@ -0,0 +1,54 @@
# camelcase-keys [![Build Status](https://travis-ci.org/sindresorhus/camelcase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase-keys)
> Convert object keys to camelCase using [`camelcase`](https://github.com/sindresorhus/camelcase)
## Install
```
$ npm install --save camelcase-keys
```
## Usage
```js
const camelcaseKeys = require('camelcase-keys');
camelcaseKeys({'foo-bar': true});
//=> {fooBar: true}
const argv = require('minimist')(process.argv.slice(2));
//=> {_: [], 'foo-bar': true}
camelcaseKeys(argv);
//=> {_: [], fooBar: true}
```
## API
### camelcaseKeys(input, [options])
#### input
Type: `object`
Object to camelCase.
#### options
Type: `object`
##### exclude
Type: `array`
Default: `[]`
Exclude keys from being camelCased.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,56 @@
'use strict';
function preserveCamelCase(str) {
var isLastCharLower = false;
for (var i = 0; i < str.length; i++) {
var c = str.charAt(i);
if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) {
str = str.substr(0, i) + '-' + str.substr(i);
isLastCharLower = false;
i++;
} else {
isLastCharLower = (c.toLowerCase() === c);
}
}
return str;
}
module.exports = function () {
var str = [].map.call(arguments, function (str) {
return str.trim();
}).filter(function (str) {
return str.length;
}).join('-');
if (!str.length) {
return '';
}
if (str.length === 1) {
return str;
}
if (!(/[_.\- ]+/).test(str)) {
if (str === str.toUpperCase()) {
return str.toLowerCase();
}
if (str[0] !== str[0].toLowerCase()) {
return str[0].toLowerCase() + str.slice(1);
}
return str;
}
str = preserveCamelCase(str);
return str
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
return p1.toUpperCase();
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1,39 @@
{
"name": "camelcase",
"version": "2.1.1",
"description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
"license": "MIT",
"repository": "sindresorhus/camelcase",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@@ -0,0 +1,57 @@
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar`
## Install
```
$ npm install --save camelcase
```
## Usage
```js
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('--foo.bar');
//=> 'fooBar'
camelCase('__foo__bar__');
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase('foo', 'bar');
//=> 'fooBar'
camelCase('__foo__', '--bar');
//=> 'fooBar'
```
## Related
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,82 @@
'use strict';
var path = require('path');
var minimist = require('minimist');
var objectAssign = require('object-assign');
var camelcaseKeys = require('camelcase-keys');
var decamelize = require('decamelize');
var mapObj = require('map-obj');
var trimNewlines = require('trim-newlines');
var redent = require('redent');
var readPkgUp = require('read-pkg-up');
var loudRejection = require('loud-rejection');
var normalizePackageData = require('normalize-package-data');
// get the uncached parent
delete require.cache[__filename];
var parentDir = path.dirname(module.parent.filename);
module.exports = function (opts, minimistOpts) {
loudRejection();
if (Array.isArray(opts) || typeof opts === 'string') {
opts = {help: opts};
}
opts = objectAssign({
pkg: readPkgUp.sync({
cwd: parentDir,
normalize: false
}).pkg,
argv: process.argv.slice(2)
}, opts);
minimistOpts = objectAssign({}, minimistOpts);
minimistOpts.default = mapObj(minimistOpts.default || {}, function (key, value) {
return [decamelize(key, '-'), value];
});
if (Array.isArray(opts.help)) {
opts.help = opts.help.join('\n');
}
var pkg = typeof opts.pkg === 'string' ? require(path.join(parentDir, opts.pkg)) : opts.pkg;
var argv = minimist(opts.argv, minimistOpts);
var help = redent(trimNewlines(opts.help || ''), 2);
normalizePackageData(pkg);
process.title = pkg.bin ? Object.keys(pkg.bin)[0] : pkg.name;
var description = opts.description;
if (!description && description !== false) {
description = pkg.description;
}
help = (description ? '\n ' + description + '\n' : '') + (help ? '\n' + help : '\n');
var showHelp = function (code) {
console.log(help);
process.exit(code || 0);
};
if (argv.version && opts.version !== false) {
console.log(typeof opts.version === 'string' ? opts.version : pkg.version);
process.exit();
}
if (argv.help && opts.help !== false) {
showHelp();
}
var _ = argv._;
delete argv._;
return {
input: _,
flags: camelcaseKeys(argv),
pkg: pkg,
help: help,
showHelp: showHelp
};
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1,58 @@
{
"name": "meow",
"version": "3.7.0",
"description": "CLI app helper",
"license": "MIT",
"repository": "sindresorhus/meow",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"cli",
"bin",
"util",
"utility",
"helper",
"argv",
"command",
"line",
"meow",
"cat",
"kitten",
"parser",
"option",
"flags",
"input",
"cmd",
"console"
],
"dependencies": {
"camelcase-keys": "^2.0.0",
"decamelize": "^1.1.2",
"loud-rejection": "^1.0.0",
"map-obj": "^1.0.1",
"minimist": "^1.1.3",
"normalize-package-data": "^2.3.4",
"object-assign": "^4.0.1",
"read-pkg-up": "^1.0.1",
"redent": "^1.0.0",
"trim-newlines": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"execa": "^0.1.1",
"indent-string": "^2.1.0",
"xo": "*"
}
}

View File

@@ -0,0 +1,159 @@
# meow [![Build Status](https://travis-ci.org/sindresorhus/meow.svg?branch=master)](https://travis-ci.org/sindresorhus/meow)
> CLI app helper
![](meow.gif)
## Features
- Parses arguments using [minimist](https://github.com/substack/minimist)
- Converts flags to [camelCase](https://github.com/sindresorhus/camelcase)
- Outputs version when `--version`
- Outputs description and supplied help text when `--help`
- Makes unhandled rejected promises [fail loudly](https://github.com/sindresorhus/loud-rejection) instead of the default silent fail
- Sets the process title to the binary name defined in package.json
## Install
```
$ npm install --save meow
```
## Usage
```
$ ./foo-app.js unicorns --rainbow-cake
```
```js
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const foo = require('./');
const cli = meow(`
Usage
$ foo <input>
Options
-r, --rainbow Include a rainbow
Examples
$ foo unicorns --rainbow
🌈 unicorns 🌈
`, {
alias: {
r: 'rainbow'
}
});
/*
{
input: ['unicorns'],
flags: {rainbow: true},
...
}
*/
foo(cli.input[0], cli.flags);
```
## API
### meow(options, [minimistOptions])
Returns an object with:
- `input` *(array)* - Non-flag arguments
- `flags` *(object)* - Flags converted to camelCase
- `pkg` *(object)* - The `package.json` object
- `help` *(object)* - The help text used with `--help`
- `showHelp([code=0])` *(function)* - Show the help text and exit with `code`
#### options
Type: `object`, `array`, `string`
Can either be a string/array that is the `help` or an options object.
##### description
Type: `string`, `boolean`
Default: The package.json `"description"` property
A description to show above the help text.
Set it to `false` to disable it altogether.
##### help
Type: `string`, `boolean`
The help text you want shown.
The input is reindented and starting/ending newlines are trimmed which means you can use a [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings) without having to care about using the correct amount of indent.
<del>If it's an array each item will be a line.</del>
*(Still supported, but you should use a template literal instead.)*
The description will be shown above your help text automatically.
Set it to `false` to disable it altogether.
##### version
Type: `string`, `boolean`
Default: The package.json `"version"` property
Set a custom version output.
Set it to `false` to disable it altogether.
##### pkg
Type: `string`, `object`
Default: Closest package.json upwards
Relative path to package.json or as an object.
##### argv
Type: `array`
Default: `process.argv.slice(2)`
Custom arguments object.
#### minimistOptions
Type: `object`
Default: `{}`
Minimist [options](https://github.com/substack/minimist#var-argv--parseargsargs-opts).
Keys passed to the minimist `default` option are [decamelized](https://github.com/sindresorhus/decamelize), so you can for example pass in `fooBar: 'baz'` and have it be the default for the `--foo-bar` flag.
## Promises
Meow will make unhandled rejected promises [fail loudly](https://github.com/sindresorhus/loud-rejection) instead of the default silent fail. Meaning you don't have to manually `.catch()` promises used in your CLI.
## Tips
See [`chalk`](https://github.com/chalk/chalk) if you want to colorize the terminal output.
See [`get-stdin`](https://github.com/sindresorhus/get-stdin) if you want to accept input from stdin.
See [`update-notifier`](https://github.com/yeoman/update-notifier) if you want update notifications.
See [`configstore`](https://github.com/yeoman/configstore) if you need to persist some data.
[More useful CLI utilities.](https://github.com/sindresorhus/awesome-nodejs#command-line-utilities)
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,7 @@
'use strict';
var stripIndent = require('strip-indent');
var indentString = require('indent-string');
module.exports = function (str, count, indent) {
return indentString(stripIndent(str), indent || ' ', count || 0);
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1 @@
../../../../../get-pkg-repo/node_modules/strip-indent/cli.js

View File

@@ -0,0 +1,43 @@
{
"name": "redent",
"version": "1.0.0",
"description": "Strip redundant indentation and indent the string",
"license": "MIT",
"repository": "sindresorhus/redent",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"string",
"str",
"strip",
"trim",
"indent",
"indentation",
"add",
"reindent",
"normalize",
"remove",
"whitespace",
"space"
],
"dependencies": {
"indent-string": "^2.1.0",
"strip-indent": "^1.0.1"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@@ -0,0 +1,48 @@
# redent [![Build Status](https://travis-ci.org/sindresorhus/redent.svg?branch=master)](https://travis-ci.org/sindresorhus/redent)
> [Strip redundant indentation](https://github.com/sindresorhus/strip-indent) and [indent the string](https://github.com/sindresorhus/indent-string)
## Install
```
$ npm install --save redent
```
## Usage
```js
const redent = require('redent');
redent('\n foo\n bar\n', 1);
//=> '\n foo\n bar\n'
```
## API
### redent(input, [count], [indent])
#### input
Type: `string`
#### count
Type: `number`
Default: `0`
How many times you want `indent` repeated.
#### indent
Type: `string`
Default: `' '`
The string to use for the indent.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var stdin = require('get-stdin');
var pkg = require('./package.json');
var stripIndent = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' strip-indent <file>',
' echo <string> | strip-indent',
'',
' Example',
' echo \'\\tunicorn\\n\\t\\tcake\' | strip-indent',
' unicorn',
' \tcake'
].join('\n'));
}
function init(data) {
console.log(stripIndent(data));
}
if (argv.indexOf('--help') !== -1) {
help();
return;
}
if (argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}
if (process.stdin.isTTY) {
if (!input) {
help();
return;
}
init(fs.readFileSync(input, 'utf8'));
} else {
stdin(init);
}

View File

@@ -0,0 +1,16 @@
'use strict';
module.exports = function (str) {
var match = str.match(/^[ \t]*(?=\S)/gm);
if (!match) {
return str;
}
var indent = Math.min.apply(Math, match.map(function (el) {
return el.length;
}));
var re = new RegExp('^[ \\t]{' + indent + '}', 'gm');
return indent > 0 ? str.replace(re, '') : str;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1,46 @@
{
"name": "strip-indent",
"version": "1.0.1",
"description": "Strip leading whitespace from every line in a string",
"license": "MIT",
"repository": "sindresorhus/strip-indent",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bin": {
"strip-indent": "cli.js"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js",
"cli.js"
],
"keywords": [
"cli",
"bin",
"browser",
"strip",
"normalize",
"remove",
"indent",
"indentation",
"whitespace",
"space",
"tab",
"string",
"str"
],
"devDependencies": {
"mocha": "*"
},
"dependencies": {
"get-stdin": "^4.0.1"
}
}

View File

@@ -0,0 +1,61 @@
# strip-indent [![Build Status](https://travis-ci.org/sindresorhus/strip-indent.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-indent)
> Strip leading whitespace from every line in a string
The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove.
Useful for removing redundant indentation.
## Install
```sh
$ npm install --save strip-indent
```
## Usage
```js
var str = '\tunicorn\n\t\tcake';
/*
unicorn
cake
*/
stripIndent('\tunicorn\n\t\tcake');
/*
unicorn
cake
*/
```
## CLI
```sh
$ npm install --global strip-indent
```
```sh
$ strip-indent --help
Usage
strip-indent <file>
echo <string> | strip-indent
Example
echo '\tunicorn\n\t\tcake' | strip-indent
unicorn
cake
```
## Related
- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,13 @@
'use strict';
var fn = module.exports = function (x) {
return fn.end(fn.start(x));
};
fn.start = function (x) {
return x.replace(/^[\r\n]+/, '');
};
fn.end = function (x) {
return x.replace(/[\r\n]+$/, '');
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

View File

@@ -0,0 +1,42 @@
{
"name": "trim-newlines",
"version": "1.0.0",
"description": "Trim newlines from the start and/or end of a string",
"license": "MIT",
"repository": "sindresorhus/trim-newlines",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"trim",
"newline",
"newlines",
"linebreak",
"lf",
"crlf",
"left",
"right",
"start",
"end",
"string",
"str",
"remove",
"delete",
"strip"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@@ -0,0 +1,46 @@
# trim-newlines [![Build Status](https://travis-ci.org/sindresorhus/trim-newlines.svg?branch=master)](https://travis-ci.org/sindresorhus/trim-newlines)
> Trim [newlines](https://en.wikipedia.org/wiki/Newline) from the start and/or end of a string
## Install
```
$ npm install --save trim-newlines
```
## Usage
```js
var trimNewlines = require('trim-newlines');
trimNewlines('\nunicorn\r\n');
//=> 'unicorn'
```
## API
### trimNewlines(input)
Trim from the start and end of a string.
### trimNewlines.start(input)
Trim from the start of a string.
### trimNewlines.end(input)
Trim from the end of a string.
## Related
- [trim-left](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left
- [trim-right](https://github.com/sindresorhus/trim-right) - Similar to `String#trim()` but removes only whitespace on the right.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,49 @@
{
"name": "conventional-recommended-bump",
"version": "1.2.1",
"description": "Get a recommended version bump based on conventional commits",
"homepage": "https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-recommended-bump",
"author": {
"name": "Steve Mao",
"email": "maochenyan@gmail.com",
"url": "https://github.com/stevemao"
},
"repository": "conventional-changelog/conventional-recommended-bump",
"license": "MIT",
"files": [
"index.js",
"cli.js",
"presets"
],
"keywords": [
"conventional-recommended-bump",
"recommend",
"conventional",
"bump"
],
"dependencies": {
"concat-stream": "^1.4.10",
"conventional-commits-filter": "^1.1.1",
"conventional-commits-parser": "^2.1.1",
"git-raw-commits": "^1.3.0",
"git-semver-tags": "^1.3.0",
"meow": "^3.3.0",
"object-assign": "^4.0.1"
},
"devDependencies": {
"better-than-before": "^1.0.0",
"core-assert": "^0.2.0",
"coveralls": "^2.11.2",
"jscs": "^3.0.7",
"jshint": "^2.6.3",
"mkdirp": "^0.5.1",
"mocha": "*",
"shelljs": "^0.7.3"
},
"scripts": {
"lint": "jshint presets test *.js --exclude node_modules && jscs presets test *.js",
"test": "npm run-script lint && mocha --timeout 30000",
"test-windows": "mocha --timeout 30000"
},
"bin": "cli.js"
}

View File

@@ -0,0 +1,37 @@
var presetOpts = {
whatBump: function(commits) {
var level = 2;
var breakings = 0;
var features = 0;
commits.forEach(function(commit) {
if (commit.notes.length > 0) {
breakings += commit.notes.length;
level = 0;
} else if (commit.type === 'feat') {
features += 1;
if (level === 2) {
level = 1;
}
}
});
return {
level: level,
reason: 'There are ' + breakings + ' BREAKING CHANGES and ' + features + ' features'
};
},
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?\: (.*)$/,
headerCorrespondence: [
'type',
'scope',
'subject'
],
noteKeywords: 'BREAKING CHANGE',
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: ['header', 'hash']
}
};
module.exports = presetOpts;

View File

@@ -0,0 +1,39 @@
var presetOpts = {
whatBump: function(commits) {
var level = 2;
var breakings = 0;
var features = 0;
commits.forEach(function(commit) {
if (!commit.type) {
return;
}
if (commit.type.toLowerCase() === 'breaking') {
breakings += 1;
level = 0;
} else if (commit.type.toLowerCase() === 'new') {
features += 1;
if (level === 2) {
level = 1;
}
}
});
return {
level: level,
reason: 'There are ' + breakings + ' breaking changes and ' + features + ' features'
};
},
parserOpts: {
headerPattern: /^(\w*): (.*)$/,
headerCorrespondence: [
'type',
'subject'
],
revertPattern: /^[rR]evert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: ['header', 'hash']
}
};
module.exports = presetOpts;