diff --git a/lib/build-command.js b/lib/build-command.js index bea0525..a1f10db 100644 --- a/lib/build-command.js +++ b/lib/build-command.js @@ -2,12 +2,12 @@ import rendy from 'rendy'; const gitTemplate = [ 'git log {{ version }}..HEAD --pretty=format:"- %h %s"', - '--grep "{{ category }}("', - '--grep "{{ category }}: "', + '--grep "^{{ category }}("', + '--grep "^{{ category }}: "', '|', - 'sed "s/{{ category }}(/(/g"', + 'sed "s/{{ category }}(/(/"', '|', - 'sed "s/{{ category }}: //g"', + 'sed "s/{{ category }}: //"', ].join(' '); export default (category, version) => { diff --git a/lib/build-command.spec.js b/lib/build-command.spec.js index 0a05e47..69bd0cf 100644 --- a/lib/build-command.spec.js +++ b/lib/build-command.spec.js @@ -5,11 +5,11 @@ test('changelog: build-command', (t) => { const result = buildCommand('fix', 'v1.0.0'); const expected = [ 'git log v1.0.0..HEAD --pretty=format:"- %h %s"', - '--grep "fix(" --grep "fix: "', + '--grep "^fix(" --grep "^fix: "', '|', - 'sed "s/fix(/(/g"', + 'sed "s/fix(/(/"', '|', - 'sed "s/fix: //g"', + 'sed "s/fix: //"', ].join(' '); t.equal(result, expected); diff --git a/lib/changelog.js b/lib/changelog.js index 922db0e..314e523 100644 --- a/lib/changelog.js +++ b/lib/changelog.js @@ -72,6 +72,8 @@ export default (versionNew, overrides) => { } } + console.log(data); + if (!data) throw Error(`No new 'feature' and 'fix' commits from ${version}`);