Skip to content

Commit

Permalink
Merge pull request #40 from bakert/show-author-in-output
Browse files Browse the repository at this point in the history
feat: include package author in output, but still don't add them to contributors
  • Loading branch information
Kikobeats authored Oct 17, 2024
2 parents a64cb0b + d64d1c8 commit 9ccd260
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ const getContributors = async () => {
return acc
}, [])
.filter(({ name }) => !REGEX_BOT_NAMES.test(name))
.filter(({ email }) =>
isString(pkgAuthor)
? !new RegExp(pkgAuthor, 'i').test(email)
: !isSameEmail(pkgAuthor.email, email)
)
.filter(({ email }) => emailRegex().test(email))
.filter(({ author }) => !(ignorePatternReg && ignorePatternReg.test(author)))
.sort(
Expand All @@ -150,15 +145,21 @@ const getContributors = async () => {

if (contributors.length) {
if (print) {
(print === 'verbose' ? renderContributorsVerbose : renderContributors)(
;(print === 'verbose' ? renderContributorsVerbose : renderContributors)(
contributors,
maxIndent
)
}
const pkg = await loadPkg(pkgPath)

if (pkg && save) {
const newContributors = contributors.map(({ author }) => author)
const newContributors = contributors
.filter(({ email }) =>
isString(pkgAuthor)
? !new RegExp(pkgAuthor, 'i').test(email)
: !isSameEmail(pkgAuthor.email, email)
)
.map(({ author }) => author)
const newPkg = { ...pkg, contributors: newContributors }
await jsonFuture.saveAsync(pkgPath, newPkg)
if (print) {
Expand Down

0 comments on commit 9ccd260

Please sign in to comment.