Skip to content

Commit 088f625

Browse files
committed
build: fix indentation for multi-line breaking changes and avoid duplicated contributors
1 parent 551e3d2 commit 088f625

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

lib/node_modules/@stdlib/_tools/changelog/generate/lib/breaking_changes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ var STDLIB_GITHUB_URL = 'https://github.com/stdlib-js/stdlib/commit';
5454
* // returns '- [`abcdef1`](https://github.com/stdlib-js/stdlib/commit/abcdef1234567890): beep'
5555
*/
5656
function formatBreakingChange( note ) {
57-
var parts = note.text.split( '\n' );
57+
var parts = note.text.split( /\n/g );
5858
var hash = trim( note.hash );
5959
var out = '- [`'+hash.substring( 0, 7 )+'`]('+STDLIB_GITHUB_URL+'/'+hash+'): '+parts[ 0 ];
6060
if ( parts.length > 1 ) {
61-
out +=' \n\n';
61+
out +='\n\n';
6262
out += ' - ';
63-
out += parts.slice( 1 ).join( '\n ' );
63+
out += parts.slice( 1 ).join( '\n ' );
6464
out += '\n';
6565
}
6666
return out;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[
2-
"stdlib-bot <[email protected]>"
2+
"dependabot[bot]",
3+
"stdlib-bot"
34
]

lib/node_modules/@stdlib/_tools/changelog/generate/lib/format_contributors.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,33 @@ var RE_CO_AUTHORED_BY = /co-authored-by/i;
4646
function extractContributors( commits ) {
4747
var mentions;
4848
var mention;
49+
var author;
4950
var out;
5051
var i;
5152
var j;
5253

5354
out = [];
5455
for ( i = 0; i < commits.length; i++ ) {
56+
author = replace( commits[ i ].author, /\s*<[^>]+>\s*/, '' );
5557
if (
56-
!contains( out, commits[ i ].author ) &&
57-
!contains( EXCLUDED_CONTRIBUTORS, commits[ i ].author )
58+
!contains( out, author ) &&
59+
!contains( EXCLUDED_CONTRIBUTORS, author )
5860
) {
59-
out.push( commits[ i ].author );
61+
out.push( author );
6062
}
6163
mentions = commits[ i ].mentions || [];
6264
for ( j = 0; j < mentions.length; j++ ) {
6365
mention = mentions[ j ];
6466
if (
65-
RE_CO_AUTHORED_BY.test( mention.action ) &&
66-
!contains( out, mention.ref ) &&
67-
!contains( EXCLUDED_CONTRIBUTORS, mention.ref )
67+
RE_CO_AUTHORED_BY.test( mention.action )
6868
) {
69-
out.push( mention.ref );
69+
author = replace( mention.ref, /\s*<[^>]+>\s*/, '' );
70+
if (
71+
!contains( out, author ) &&
72+
!contains( EXCLUDED_CONTRIBUTORS, author )
73+
) {
74+
out.push( author );
75+
}
7076
}
7177
}
7278
}
@@ -77,15 +83,15 @@ function extractContributors( commits ) {
7783
* Formats a contributor.
7884
*
7985
* @private
80-
* @param {string} contributor - contributor
86+
* @param {string} contributor - contributor name
8187
* @returns {string} formatted contributor
8288
*
8389
* @example
84-
* var out = formatContributor( 'Jane Doe <[email protected]>' );
90+
* var out = formatContributor( 'Jane Doe' );
8591
* // returns '- Jane Doe'
8692
*/
8793
function formatContributor( contributor ) {
88-
return '- ' + replace( contributor, /\s*<[^>]+>\s*/, '' );
94+
return '- ' + contributor;
8995
}
9096

9197

0 commit comments

Comments
 (0)