@@ -4,77 +4,73 @@ var Q = require('q');
4
4
var readFile = Q . denodeify ( require ( 'fs' ) . readFile ) ;
5
5
var resolve = require ( 'path' ) . resolve ;
6
6
7
- function presetOpts ( ) {
8
- var parserOpts = {
9
- headerPattern : / ^ ( \w * ) (?: \( ( .* ) \) ) ? \: ( .* ) $ / ,
10
- headerCorrespondence : [
11
- 'type' ,
12
- 'scope' ,
13
- 'subject'
14
- ] ,
15
- noteKeywords : 'BREAKING CHANGE' ,
16
- revertPattern : / ^ r e v e r t : \s ( [ \s \S ] * ?) \s * T h i s r e v e r t s c o m m i t ( \w * ) \. / ,
17
- revertCorrespondence : [ 'header' , 'hash' ]
18
- } ;
7
+ var parserOpts = {
8
+ headerPattern : / ^ ( \w * ) (?: \( ( .* ) \) ) ? \: ( .* ) $ / ,
9
+ headerCorrespondence : [
10
+ 'type' ,
11
+ 'scope' ,
12
+ 'subject'
13
+ ] ,
14
+ noteKeywords : 'BREAKING CHANGE' ,
15
+ revertPattern : / ^ r e v e r t : \s ( [ \s \S ] * ?) \s * T h i s r e v e r t s c o m m i t ( \w * ) \. / ,
16
+ revertCorrespondence : [ 'header' , 'hash' ]
17
+ } ;
19
18
20
- var writerOpts = {
21
- transform : function ( commit ) {
22
- if ( commit . type === 'feat' ) {
23
- commit . type = 'Features' ;
24
- } else if ( commit . type === 'fix' ) {
25
- commit . type = 'Bug Fixes' ;
26
- } else if ( commit . type === 'perf' ) {
27
- commit . type = 'Performance Improvements' ;
28
- } else if ( commit . type === 'revert' ) {
29
- commit . type = 'Reverts' ;
30
- } else {
31
- return ;
32
- }
33
-
34
- if ( commit . scope === '*' ) {
35
- commit . scope = '' ;
36
- }
19
+ var writerOpts = {
20
+ transform : function ( commit ) {
21
+ if ( commit . type === 'feat' ) {
22
+ commit . type = 'Features' ;
23
+ } else if ( commit . type === 'fix' ) {
24
+ commit . type = 'Bug Fixes' ;
25
+ } else if ( commit . type === 'perf' ) {
26
+ commit . type = 'Performance Improvements' ;
27
+ } else if ( commit . type === 'revert' ) {
28
+ commit . type = 'Reverts' ;
29
+ } else {
30
+ return ;
31
+ }
37
32
38
- if ( typeof commit . hash === 'string ' ) {
39
- commit . hash = commit . hash . substring ( 0 , 7 ) ;
40
- }
33
+ if ( commit . scope === '* ' ) {
34
+ commit . scope = '' ;
35
+ }
41
36
42
- if ( typeof commit . subject === 'string' ) {
43
- commit . subject = commit . subject . substring ( 0 , 80 ) ;
44
- }
37
+ if ( typeof commit . hash === 'string' ) {
38
+ commit . hash = commit . hash . substring ( 0 , 7 ) ;
39
+ }
45
40
46
- commit . notes . forEach ( function ( note ) {
47
- if ( note . title === 'BREAKING CHANGE' ) {
48
- note . title = 'BREAKING CHANGES' ;
49
- }
50
- } ) ;
41
+ if ( typeof commit . subject === 'string' ) {
42
+ commit . subject = commit . subject . substring ( 0 , 80 ) ;
43
+ }
51
44
52
- return commit ;
53
- } ,
54
- groupBy : 'type' ,
55
- commitGroupsSort : 'title' ,
56
- commitsSort : [ 'scope' , 'subject' ] ,
57
- noteGroupsSort : 'title' ,
58
- notesSort : compareFunc
59
- } ;
45
+ commit . notes . forEach ( function ( note ) {
46
+ if ( note . title === 'BREAKING CHANGE' ) {
47
+ note . title = 'BREAKING CHANGES' ;
48
+ }
49
+ } ) ;
60
50
61
- return Q . all ( [
62
- readFile ( resolve ( __dirname , 'templates/template.hbs' ) , 'utf-8' ) ,
63
- readFile ( resolve ( __dirname , 'templates/header.hbs' ) , 'utf-8' ) ,
64
- readFile ( resolve ( __dirname , 'templates/commit.hbs' ) , 'utf-8' ) ,
65
- readFile ( resolve ( __dirname , 'templates/footer.hbs' ) , 'utf-8' )
66
- ] )
67
- . spread ( function ( template , header , commit , footer ) {
68
- writerOpts . mainTemplate = template ;
69
- writerOpts . headerPartial = header ;
70
- writerOpts . commitPartial = commit ;
71
- writerOpts . footerPartial = footer ;
51
+ return commit ;
52
+ } ,
53
+ groupBy : 'type' ,
54
+ commitGroupsSort : 'title' ,
55
+ commitsSort : [ 'scope' , 'subject' ] ,
56
+ noteGroupsSort : 'title' ,
57
+ notesSort : compareFunc
58
+ } ;
72
59
73
- return {
74
- parserOpts : parserOpts ,
75
- writerOpts : writerOpts
76
- } ;
77
- } ) ;
78
- }
60
+ module . exports = Q . all ( [
61
+ readFile ( resolve ( __dirname , 'templates/template.hbs' ) , 'utf-8' ) ,
62
+ readFile ( resolve ( __dirname , 'templates/header.hbs' ) , 'utf-8' ) ,
63
+ readFile ( resolve ( __dirname , 'templates/commit.hbs' ) , 'utf-8' ) ,
64
+ readFile ( resolve ( __dirname , 'templates/footer.hbs' ) , 'utf-8' )
65
+ ] )
66
+ . spread ( function ( template , header , commit , footer ) {
67
+ writerOpts . mainTemplate = template ;
68
+ writerOpts . headerPartial = header ;
69
+ writerOpts . commitPartial = commit ;
70
+ writerOpts . footerPartial = footer ;
79
71
80
- module . exports = presetOpts ;
72
+ return {
73
+ parserOpts : parserOpts ,
74
+ writerOpts : writerOpts
75
+ } ;
76
+ } ) ;
0 commit comments