@@ -2,10 +2,10 @@ module.exports = {
22 template : {
33 commit : ( { message, url, author, name} ) =>
44 `- [${ message } ](${ url } ) - ${ author ? `@${ author } ` : name } ` ,
5- issue : '- { {name}} [{{ text}}]({{ url}} ) by [{{ user_login}}](https://github.com/{{user_login}})",' ,
5+ issue : ( { name , labels , text , url , user_login , user_url } ) => ` ${ processLabels ( labels ) } $ {name } [ ${ text } ]( ${ url } ) by [${ user_login } ]( ${ user_url } )` ,
66 label : '[**{{label}}**]' ,
77 noLabel : 'closed' ,
8- group : '\n#### {{heading}}\n' ,
8+ group : '\n## {{heading}}\n' ,
99 changelogTitle : '# Changelog\n\n' ,
1010 release : '## {{release}} ({{date}})\n{{body}}' ,
1111 releaseSeparator : '\n---\n\n' ,
@@ -15,6 +15,23 @@ module.exports = {
1515 'Bug fixes:' : [ 'type: accepted/bug' ] ,
1616 Features : [ 'feature' ] ,
1717 } ,
18+ groupPostProcessor : ( groupContent ) => {
19+ const lines = groupContent . split ( '\n' ) ;
20+ const iosIssues = [ ] ;
21+ const androidIssues = [ ] ;
22+ const otherIssues = [ ] ;
23+
24+ for ( let i = 0 ; i < lines . length ; i ++ ) {
25+ const line = lines [ i ] ;
26+ if ( line . includes ( '## ' ) ) continue ;
27+ else if ( line . includes ( '[iOS] ' ) ) iosIssues . push ( line . replace ( '[iOS] ' , '' ) ) ;
28+ else if ( line . includes ( '[Android] ' ) ) androidIssues . push ( line . replace ( '[Android] ' , '' ) ) ;
29+ else otherIssues . push ( line ) ;
30+ }
31+
32+ const groupHeader = groupContent . substr ( 0 , groupContent . indexOf ( ':\n' ) ) ;
33+ return `${ groupHeader } ${ generateSection ( undefined , otherIssues ) } ${ generateSection ( 'iOS' , iosIssues ) } ${ generateSection ( 'Android' , androidIssues ) } ` ;
34+ } ,
1835 ignoreIssuesWith : [ 'skip-changelog' ] ,
1936 ignoreTagsWith : [ 'snapshot' , 'v1' , 'v2' , '0\..\..' , '1\..\..' , '2\..\..' , '3\..\..' , '4\..\..' , '5\..\..' , '6\..\..' ] ,
2037 dataSource : 'prs' ,
@@ -23,3 +40,24 @@ module.exports = {
2340 generate : true ,
2441 tags : 'all'
2542} ;
43+
44+ function generateSection ( name , issues ) {
45+ if ( ! issues . length ) return '' ;
46+ let section = `${ name ? `### ${ name } \n` : '' } ` ;
47+
48+ issues . forEach ( issue => {
49+ section += `${ issue } \n` ;
50+ } ) ;
51+
52+ return `${ section } \n` ;
53+ }
54+
55+ function processLabels ( labels ) {
56+ if ( labels . includes ( '**platform: iOS**' ) ) {
57+ return '[iOS] '
58+ } else if ( labels . includes ( '**platform: Android**' ) ) {
59+ return '[Android] '
60+ }
61+
62+ return '' ;
63+ }
0 commit comments