Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/gitmoji-changelog-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ yargs
.option('group-similar-commits', { desc: '[⚗️ - beta] try to group similar commits', default: false })
.option('author', { default: false, desc: 'add the author in changelog lines' })
.option('interactive', { default: false, desc: 'select commits manually', alias: 'i' })
.option('only-stable', { default: false, desc: 'Include only stable versions when generating the changelog', type: 'boolean' })

.help('help')
.epilog(`For more information visit: ${homepage}`)
Expand Down
8 changes: 6 additions & 2 deletions packages/gitmoji-changelog-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ async function generateVersions({
}

async function generateChangelog(from, to, {
groupSimilarCommits, client = fromGitFileClient,
groupSimilarCommits, onlyStable, client = fromGitFileClient,
} = {}) {
const gitTags = await client.getTags()
let gitTags = await client.getTags()
if (onlyStable) {
gitTags = gitTags.filter((tag) => !/(dev|rc|alpha|beta)/i.test(tag))
}

let tagsToProcess = [...gitTags]
const hasNext = hasNextVersion(gitTags, to)

Expand Down
26 changes: 26 additions & 0 deletions packages/gitmoji-changelog-core/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,32 @@ describe('changelog', () => {
{ date: '2019-02-01T00:00:00+00:00', body: '9' },
])
})

it('should include unstable commits', async () => {
mockGroup([recycleCommit])
mockGroup([lipstickCommit])
mockGroup([sparklesCommit])
mockGroup([lockCommit])

gitSemverTags.mockImplementation(cb => cb(null, ['v1.0.0', 'v1.0.0-dev.1', 'v1.0.1']))

const { changes } = await generateChangelog(TAIL, HEAD, { onlyStable: false })

expect(changes).toHaveLength(4)
})

it('should exclude unstable commits', async () => {
mockGroup([recycleCommit])
mockGroup([lipstickCommit])
mockGroup([sparklesCommit])
mockGroup([lockCommit])

gitSemverTags.mockImplementation(cb => cb(null, ['v1.0.0', 'v1.0.0-dev.1', 'v1.0.1']))

const { changes } = await generateChangelog(TAIL, HEAD, { onlyStable: true })

expect(changes).toHaveLength(3)
})
})

jest.mock('git-raw-commits')
Expand Down
1 change: 1 addition & 0 deletions packages/gitmoji-changelog-documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ The first command listed above is the idiomatic usage of `gitmoji-changelog` (re
| --group-similar-commits | [⚗️,- beta] try to group similar commits | false |
| --author | add the author in changelog lines | false |
| --interactive -i | select commits manually | false |
| --only-stable | Include only stable versions when generating the changelog | false |
| --help | display help | |

### Example
Expand Down