@@ -6,13 +6,18 @@ const { tokens, packages } = require('./changelogData');
66const PACKAGE_REGEXP = new RegExp ( `${ packages . join ( '|' ) } ` ) ;
77
88const GROUPS = [
9+ 'Breaking Changes' ,
910 'Bug Fixes' ,
1011 'Features' ,
1112 'Documentation' ,
1213 'Performance Improvements' ,
1314 'Other Internal Changes' ,
1415] ;
16+ const BREAKING_CHANGES = 'Breaking Changes' ;
1517
18+ /**
19+ * @param commit {import("conventional-commits-parser").Commit}
20+ */
1621function getCommitType ( { type, scope, revert } ) {
1722 if ( type === 'revert' || revert ) {
1823 return 'Reverts' ;
@@ -74,6 +79,9 @@ function tokenize(subject) {
7479 . replace ( / ( [ a - z ] [ A - z ] + P r o p s ) / g, '`$1`' ) ;
7580}
7681
82+ /**
83+ * @type {import("conventional-changelog-core").ParserOptions }
84+ */
7785const parserOpts = {
7886 headerPattern : / ^ ( \w * ) (?: \( ( .* ) \) ) ? : ( .* ) $ / ,
7987 headerCorrespondence : [ 'type' , 'scope' , 'subject' ] ,
@@ -83,6 +91,9 @@ const parserOpts = {
8391 revertCorrespondence : [ 'header' , 'hash' ] ,
8492} ;
8593
94+ /**
95+ * @type {import("conventional-changelog-core").WriterOptions }
96+ */
8697const writerOpts = {
8798 transform : ( commit , context ) => {
8899 // don't want to show the release tag in changelog
@@ -93,8 +104,8 @@ const writerOpts = {
93104 const issues = [ ] ;
94105 let isBreaking = false ;
95106 commit . notes . forEach ( ( note ) => {
96- isBreaking = false ;
97- note . title = 'BREAKING CHANGES' ;
107+ isBreaking = true ;
108+ note . title = BREAKING_CHANGES ;
98109 } ) ;
99110
100111 commit . type = getCommitType ( commit ) ;
@@ -165,6 +176,8 @@ const writerOpts = {
165176 * This is basically the conventional-changelog-angular with a few changes to
166177 * allow more commit messages to appear. I also "tokenize" known packages and
167178 * exports from react-md in the changelogs.
179+ *
180+ * @type {import("conventional-changelog-core").Options.Config }
168181 */
169182module . exports = {
170183 parserOpts,
0 commit comments