Skip to content

Commit 893405e

Browse files
committed
build: only keep last breaking change
1 parent 779b35c commit 893405e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/node_modules/@stdlib/_tools/changelog/parse-commits/lib/conventional_changelog.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var RE_LEADING_HASH = /^\s*#/;
4747
* @returns {Object} conventional changelog format
4848
*/
4949
function toConventionalChangelog( ast, options ) {
50+
var breakingChanges = [];
5051
var out = {
5152
'type': '',
5253
'scope': null,
@@ -64,6 +65,10 @@ function toConventionalChangelog( ast, options ) {
6465
visitWithAncestors( ast, [ 'breaking-change' ], processBreakingChanges );
6566
visit( ast, 'footer', processFooter );
6667

68+
// Only keep the last breaking change note:
69+
if ( breakingChanges.length > 0 ) {
70+
out.notes.push( breakingChanges[ breakingChanges.length-1 ] );
71+
}
6772
return out;
6873

6974
/**
@@ -96,7 +101,7 @@ function toConventionalChangelog( ast, options ) {
96101
break;
97102
}
98103
if ( breaking.text !== '' ) {
99-
out.notes.push( breaking );
104+
breakingChanges.push( breaking );
100105
}
101106

102107
/**

0 commit comments

Comments
 (0)