From 51474bb68d4579955a4a9cebc62a47877dd426a0 Mon Sep 17 00:00:00 2001 From: bcoe Date: Wed, 1 Jan 2020 20:33:22 -0800 Subject: [PATCH 1/2] feat: add support for 'feature' as alias for 'feat' --- .../conventional-recommended-bump.js | 2 +- .../test/test.js | 49 +++++++++++++++---- .../writer-opts.js | 1 + 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/packages/conventional-changelog-conventionalcommits/conventional-recommended-bump.js b/packages/conventional-changelog-conventionalcommits/conventional-recommended-bump.js index f9393723d..ee2cf92da 100644 --- a/packages/conventional-changelog-conventionalcommits/conventional-recommended-bump.js +++ b/packages/conventional-changelog-conventionalcommits/conventional-recommended-bump.js @@ -20,7 +20,7 @@ module.exports = function (config) { if (commit.notes.length > 0) { breakings += commit.notes.length level = 0 - } else if (commit.type === 'feat') { + } else if (commit.type === 'feat' || commit.type === 'feature') { features += 1 if (level === 2) { level = 1 diff --git a/packages/conventional-changelog-conventionalcommits/test/test.js b/packages/conventional-changelog-conventionalcommits/test/test.js index 75a6636cc..a9aef6ee1 100644 --- a/packages/conventional-changelog-conventionalcommits/test/test.js +++ b/packages/conventional-changelog-conventionalcommits/test/test.js @@ -53,7 +53,11 @@ betterThanBefore.setups([ }, function () { shell.exec('git tag v0.1.0') - gitDummyCommit('feat: some more features') + gitDummyCommit('feat: some more feats') + }, + function () { + shell.exec('git tag v0.2.0') + gitDummyCommit('feature: some more features') }, function () { gitDummyCommit(['feat(*): implementing #5 by @dlmr', ' closes #10']) @@ -322,6 +326,31 @@ describe('conventionalcommits.org preset', function () { preparing(6) var i = 0 + conventionalChangelogCore({ + config: preset, + outputUnreleased: true + }) + .on('error', function (err) { + done(err) + }) + .pipe(through(function (chunk, enc, cb) { + chunk = chunk.toString() + + expect(chunk).to.include('some more feats') + expect(chunk).to.not.include('BREAKING') + + i++ + cb() + }, function () { + expect(i).to.equal(1) + done() + })) + }) + + it('should support "feature" as alias for "feat"', function (done) { + preparing(7) + var i = 0 + conventionalChangelogCore({ config: preset, outputUnreleased: true @@ -344,7 +373,7 @@ describe('conventionalcommits.org preset', function () { }) it('should work with unknown host', function (done) { - preparing(6) + preparing(7) var i = 0 conventionalChangelogCore({ @@ -374,7 +403,7 @@ describe('conventionalcommits.org preset', function () { }) it('should work specifying where to find a package.json using conventional-changelog-core', function (done) { - preparing(7) + preparing(8) var i = 0 conventionalChangelogCore({ @@ -402,7 +431,7 @@ describe('conventionalcommits.org preset', function () { }) it('should fallback to the closest package.json when not providing a location for a package.json', function (done) { - preparing(7) + preparing(8) var i = 0 conventionalChangelogCore({ @@ -428,7 +457,7 @@ describe('conventionalcommits.org preset', function () { }) it('should support non public GitHub repository locations', function (done) { - preparing(7) + preparing(8) conventionalChangelogCore({ config: preset, @@ -453,7 +482,7 @@ describe('conventionalcommits.org preset', function () { }) it('should only replace with link to user if it is an username', function (done) { - preparing(8) + preparing(9) conventionalChangelogCore({ config: preset @@ -474,7 +503,7 @@ describe('conventionalcommits.org preset', function () { }) it('supports multiple lines of footer information', function (done) { - preparing(8) + preparing(9) conventionalChangelogCore({ config: preset @@ -492,7 +521,7 @@ describe('conventionalcommits.org preset', function () { }) it('does not require that types are case sensitive', function (done) { - preparing(8) + preparing(9) conventionalChangelogCore({ config: preset @@ -508,7 +537,7 @@ describe('conventionalcommits.org preset', function () { }) it('populates breaking change if ! is present', function (done) { - preparing(8) + preparing(9) conventionalChangelogCore({ config: preset @@ -524,7 +553,7 @@ describe('conventionalcommits.org preset', function () { }) it('parses both default (Revert "") and custom (revert: ) revert commits', function (done) { - preparing(9) + preparing(10) conventionalChangelogCore({ config: preset diff --git a/packages/conventional-changelog-conventionalcommits/writer-opts.js b/packages/conventional-changelog-conventionalcommits/writer-opts.js index 1c3339b55..8e21b8e73 100644 --- a/packages/conventional-changelog-conventionalcommits/writer-opts.js +++ b/packages/conventional-changelog-conventionalcommits/writer-opts.js @@ -161,6 +161,7 @@ function defaultConfig (config) { config = config || {} config.types = config.types || [ { type: 'feat', section: 'Features' }, + { type: 'feature', section: 'Features' }, { type: 'fix', section: 'Bug Fixes' }, { type: 'perf', section: 'Performance Improvements' }, { type: 'revert', section: 'Reverts' }, From a7923e37ff15fd65011b335226f76b24fd592483 Mon Sep 17 00:00:00 2001 From: Tomasz Wojtun Date: Wed, 29 Jan 2020 20:42:46 +0100 Subject: [PATCH 2/2] style: correct style --- .../conventional-changelog-conventionalcommits/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/conventional-changelog-conventionalcommits/test/test.js b/packages/conventional-changelog-conventionalcommits/test/test.js index a9aef6ee1..11ce15144 100644 --- a/packages/conventional-changelog-conventionalcommits/test/test.js +++ b/packages/conventional-changelog-conventionalcommits/test/test.js @@ -346,7 +346,7 @@ describe('conventionalcommits.org preset', function () { done() })) }) - + it('should support "feature" as alias for "feat"', function (done) { preparing(7) var i = 0