git-authors-cli
Advanced tools
Comparing version
@@ -16,9 +16,3 @@ #!/usr/bin/env node | ||
const BLACKLIST_KEYWORDS = [ | ||
'ImgBotApp', | ||
'greenkeeper', | ||
'noreply', | ||
'\\bbot\\b', | ||
'Travis CI' | ||
] | ||
const BLACKLIST_KEYWORDS = ['ImgBotApp', 'greenkeeper', 'noreply', '\\bbot\\b', 'Travis CI'] | ||
@@ -31,7 +25,5 @@ const REGEX_BLACKLIST_KEYWORDS = new RegExp(BLACKLIST_KEYWORDS.join('|'), 'i') | ||
const normalizeEmail = email => | ||
email.toLowerCase().replace(REGEX_EMAIL_VARIATIONS, '') | ||
const normalizeEmail = email => email.toLowerCase().replace(REGEX_EMAIL_VARIATIONS, '') | ||
const isSameEmail = (email1 = '', email2 = '') => | ||
normalizeEmail(email1) === normalizeEmail(email2) | ||
const isSameEmail = (email1 = '', email2 = '') => normalizeEmail(email1) === normalizeEmail(email2) | ||
@@ -109,3 +101,3 @@ const processError = err => { | ||
const getContributors = async () => { | ||
if (!await existsFile('.git')) { | ||
if (!(await existsFile('.git'))) { | ||
return processError({ | ||
@@ -119,3 +111,3 @@ message: 'Ops, not git directory detected!' | ||
const cmd = `git shortlog -sne < ${TTY}` | ||
const { stdout, stderr } = await execa.shell(cmd, { cwd }) | ||
const { stdout, stderr } = await execa.command(cmd, { cwd, shell: true }) | ||
@@ -128,5 +120,3 @@ if (stderr) return processError(stderr) | ||
.reduce((acc, contributor) => { | ||
const index = acc.findIndex(({ email }) => | ||
isSameEmail(email, contributor.email) | ||
) | ||
const index = acc.findIndex(({ email }) => isSameEmail(email, contributor.email)) | ||
const isPresent = index !== -1 | ||
@@ -145,13 +135,10 @@ if (!isPresent) return acc.concat(contributor) | ||
.filter(({ author }) => !REGEX_BLACKLIST_KEYWORDS.test(author)) | ||
.filter( | ||
({ email }) => | ||
isString(pkgAuthor) | ||
? !new RegExp(pkgAuthor, 'i').test(email) | ||
: !isSameEmail(pkgAuthor.email, email) | ||
.filter(({ email }) => | ||
isString(pkgAuthor) | ||
? !new RegExp(pkgAuthor, 'i').test(email) | ||
: !isSameEmail(pkgAuthor.email, email) | ||
) | ||
.sort((c1, c2) => c2.commits - c1.commits) | ||
const maxIndent = contributors.length | ||
? getMaxIndent(contributors, 'commits') | ||
: '' | ||
const maxIndent = contributors.length ? getMaxIndent(contributors, 'commits') : '' | ||
@@ -168,5 +155,3 @@ if (contributors.length) { | ||
console.log( | ||
`\n${indent(maxIndent)} ${chalk.gray( | ||
`Added into ${chalk.white('package.json')} ✨` | ||
)}` | ||
`\n${indent(maxIndent)} ${chalk.gray(`Added into ${chalk.white('package.json')} ✨`)}` | ||
) | ||
@@ -173,0 +158,0 @@ } |
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.0.19](https://github.com/Kikobeats/git-authors-cli/compare/v1.0.18...v1.0.19) (2020-01-20) | ||
### Bug Fixes | ||
* **package:** update execa to version 2.0.0 ([bdb9a97](https://github.com/Kikobeats/git-authors-cli/commit/bdb9a972e3469790e1ae25d645e96934d30d77a2)) | ||
### [1.0.18](https://github.com/Kikobeats/git-authors-cli/compare/v1.0.17...v1.0.18) (2019-06-19) | ||
@@ -7,0 +14,0 @@ |
@@ -5,4 +5,5 @@ { | ||
"homepage": "https://nicedoc.io/Kikobeats/git-authors-cli", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"bin": { | ||
"git-authors": "bin/index.js", | ||
"git-authors-cli": "bin/index.js" | ||
@@ -35,7 +36,7 @@ }, | ||
"dependencies": { | ||
"execa": "~1.0.0", | ||
"execa": "~4.0.0", | ||
"exists-file": "~3.0.2", | ||
"json-future": "~2.2.0", | ||
"meow": "~5.0.0", | ||
"update-notifier": "~3.0.0" | ||
"json-future": "~2.2.4", | ||
"meow": "~6.0.0", | ||
"update-notifier": "~4.0.0" | ||
}, | ||
@@ -42,0 +43,0 @@ "devDependencies": { |
16117
1.53%151
-9.04%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated