Skip to content

Commit

Permalink
feat: make changelog ignored scopes configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
lekterable committed May 2, 2020
1 parent a2ec46e commit d34a9f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Latest

## Features

- make changelog groups configurable [a2ec46eb](https://github.com/lekterable/perfekt/commit/a2ec46eb9e962a79a9153300adc2229af182d4a6)

# 1.1.0

## Features
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const defaultConfig = {
['## Features', 'feat', 'feature'],
['## Fixes', 'fix']
],
lineFormat: '- %message% %hash%'
lineFormat: '- %message% %hash%',
ignoredScopes: ['changelog']
}

export const defaultChangelogOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const groupCommits = (commits, config) =>
const normalizedScope =
commitDetails.scope && commitDetails.scope.toLowerCase()

if (normalizedScope === 'changelog') return [...grouped]
if (config.ignoredScopes.includes(normalizedScope)) return [...grouped]
if (normalizedScope === 'release') {
const isLatest = isObjectEmpty(group)
const release = { release: commit }
Expand Down
4 changes: 3 additions & 1 deletion src/utils/misc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ describe('misc', () => {
['## Feat', 'feat', 'feature'],
['## Fix', 'fix'],
['## Custom', 'custom']
]
],
ignoredScopes: ['ignored']
}
const mockedInput = [
'b2f5901922505efbfb6dd684252e8df0cdffeeb2 chore!: generate changelog',
'2ea04355c1e81c5088eeabc6e242fb1ade978524 chore!: version releases',
'bffc2f9e8da1c7ac133689bc9cd14494f3be08e3 refactor: extract line generating logic to function and promisify exec',
'bffc2f9e8da1c7ac133689bc9cd14494f3be08e3 refactor(ignored): rewrite legacy code',
'aa805ce71ee103965ce3db46d4f6ed2658efd08d feat: add option to write to local CHANGELOG file',
'b2f5901922505efbfb6dd684252e8df0cdffeeb2 custom: make changelog customizable',
'f2191200bf7b6e5eec3d61fcef9eb756e0129cfb chore(release): 0.1.0',
Expand Down

0 comments on commit d34a9f1

Please sign in to comment.