@@ -18,40 +18,38 @@ const log = execSync(`git log --reverse --pretty='format:%h %H%d %s (%aN)%n%b%n-
1818main ( )
1919
2020function shortname ( url ) {
21- let matched = url . match ( / h t t p s : \/ \/ g i t h u b \. c o m \/ ( [ ^ / ] + \/ [ ^ / ] + ) \/ (?: p u l l | i s s u e s ) \/ ( \d + ) / ) ||
21+ const matched = url . match ( / h t t p s : \/ \/ g i t h u b \. c o m \/ ( [ ^ / ] + \/ [ ^ / ] + ) \/ (?: p u l l | i s s u e s ) \/ ( \d + ) / ) ||
2222 url . match ( / h t t p s : \/ \/ ( n p m \. c o m m u n i t y ) \/ t \/ (?: [ ^ / ] + \/ ) ( \d + ) / )
23- if ( ! matched ) return false
24- let repo = matched [ 1 ]
25- let id = matched [ 2 ]
26- if ( repo !== 'npm/cli' ) {
23+ if ( ! matched )
24+ return false
25+ const repo = matched [ 1 ]
26+ const id = matched [ 2 ]
27+ if ( repo !== 'npm/cli' )
2728 return `${ repo } #${ id } `
28- } else {
29+ else
2930 return `#${ id } `
30- }
3131}
3232
3333function printCommit ( c ) {
3434 console . log ( `* [\`${ c . shortid } \`](https://github.com/npm/cli/commit/${ c . fullid } )` )
3535 if ( c . fixes . length ) {
3636 for ( const fix of c . fixes ) {
37- let label = shortname ( fix )
38- if ( label ) {
37+ const label = shortname ( fix )
38+ if ( label )
3939 console . log ( ` [${ label } ](${ fix } )` )
40- }
4140 }
4241 } else if ( c . prurl ) {
43- let label = shortname ( c . prurl )
44- if ( label ) {
42+ const label = shortname ( c . prurl )
43+ if ( label )
4544 console . log ( ` [${ label } ](${ c . prurl } )` )
46- } else {
45+ else
4746 console . log ( ` [#](${ c . prurl } )` )
48- }
4947 }
50- let msg = c . message
48+ const msg = c . message
5149 . replace ( / ^ \s + / mg, '' )
5250 . replace ( / ^ [ - a - z ] + : / , '' )
5351 . replace ( / ^ / mg, ' ' )
54- . replace ( / ^ R e v i e w e d - b y : @ .* / mg, '' )
52+ . replace ( / ^ { 2 } R e v i e w e d - b y : @ .* / mg, '' )
5553 . replace ( / \n $ / , '' )
5654 // backtickify package@version
5755 . replace ( / ^ ( \s * @ ? [ ^ @ \s ] + @ \d + [ . ] \d + [ . ] \d + ) \b ( \s * \S ) / g, '$1:$2' )
@@ -60,14 +58,13 @@ function printCommit (c) {
6058 . replace ( / \b ( [ a - f 0 - 9 ] { 7 , 8 } ) \b / g, '[`$1`](https://github.com/npm/cli/commit/$1)' )
6159 console . log ( msg )
6260 // don't assign credit for dep updates
63- if ( ! / ^ ` [ ^ ` ] + @ \d + \. \d + \. \d + [ ^ ` ] * ` : ? $ / m. test ( msg ) ) {
61+ if ( ! / ^ { 2 } ` [ ^ ` ] + @ \d + \. \d + \. \d + [ ^ ` ] * ` : ? $ / m. test ( msg ) ) {
6462 if ( c . credit ) {
6563 c . credit . forEach ( function ( credit ) {
6664 console . log ( ` ([@${ credit } ](https://github.com/${ credit } ))` )
6765 } )
68- } else {
66+ } else
6967 console . log ( ` ([@${ c . author } ](https://github.com/${ c . author } ))` )
70- }
7168 }
7269}
7370
@@ -77,9 +74,9 @@ function main () {
7774 line = line . replace ( / \r / g, '' )
7875 let m
7976 /* eslint no-cond-assign:0 */
80- if ( / ^ - - - $ / . test ( line ) ) {
77+ if ( / ^ - - - $ / . test ( line ) )
8178 printCommit ( commit )
82- } else if ( m = line . match ( / ^ ( [ a - f 0 - 9 ] { 7 , 10 } ) ( [ a - f 0 - 9 ] + ) (?: [ ( ] ( [ ^ ) ] + ) [ ) ] ) ? ( .* ?) [ ( ] ( .* ?) [ ) ] / ) ) {
79+ else if ( m = line . match ( / ^ ( [ a - f 0 - 9 ] { 7 , 10 } ) ( [ a - f 0 - 9 ] + ) (?: [ ( ] ( [ ^ ) ] + ) [ ) ] ) ? ( .* ?) [ ( ] ( .* ?) [ ) ] / ) ) {
8380 commit = {
8481 shortid : m [ 1 ] ,
8582 fullid : m [ 2 ] ,
@@ -88,23 +85,23 @@ function main () {
8885 author : m [ 5 ] ,
8986 prurl : null ,
9087 fixes : [ ] ,
91- credit : null
88+ credit : null ,
9289 }
93- } else if ( m = line . match ( / ^ P R - U R L : ( .* ) / ) ) {
90+ } else if ( m = line . match ( / ^ P R - U R L : ( .* ) / ) )
9491 commit . prurl = m [ 1 ]
95- } else if ( m = line . match ( / ^ C r e d i t : @ ( .* ) / ) ) {
96- if ( ! commit . credit ) commit . credit = [ ]
92+ else if ( m = line . match ( / ^ C r e d i t : @ ( .* ) / ) ) {
93+ if ( ! commit . credit )
94+ commit . credit = [ ]
9795 commit . credit . push ( m [ 1 ] )
98- } else if ( m = line . match ( / ^ (?: F i x (?: e s ) | C l o s e s ? ) : # ? ( [ 0 - 9 ] + ) / ) ) {
96+ } else if ( m = line . match ( / ^ (?: F i x (?: e s ) | C l o s e s ? ) : # ? ( [ 0 - 9 ] + ) / ) )
9997 commit . fixes . push ( `https://github.com/npm/cli/issues/${ m [ 1 ] } ` )
100- } else if ( m = line . match ( / ^ (?: F i x (?: e s ) | C l o s e s ? ) : ( [ ^ # ] + ) # ( [ 0 - 9 ] * ) / ) ) {
98+ else if ( m = line . match ( / ^ (?: F i x (?: e s ) | C l o s e s ? ) : ( [ ^ # ] + ) # ( [ 0 - 9 ] * ) / ) )
10199 commit . fixes . push ( `https://github.com/${ m [ 1 ] } /issues/${ m [ 2 ] } ` )
102- } else if ( m = line . match ( / ^ (?: F i x (?: e s ) | C l o s e s ? ) : ( h t t p s ? : \/ \/ .* ) / ) ) {
100+ else if ( m = line . match ( / ^ (?: F i x (?: e s ) | C l o s e s ? ) : ( h t t p s ? : \/ \/ .* ) / ) )
103101 commit . fixes . push ( m [ 1 ] )
104- } else if ( m = line . match ( / ^ R e v i e w e d - B y : @ ( .* ) / ) ) {
102+ else if ( m = line . match ( / ^ R e v i e w e d - B y : @ ( .* ) / ) )
105103 commit . reviewed = m [ 1 ]
106- } else if ( / \S / . test ( line ) ) {
104+ else if ( / \S / . test ( line ) )
107105 commit . message += `\n${ line } `
108- }
109106 } )
110107}
0 commit comments