(stream, commits, version)
| 136 | |
| 137 | |
| 138 | var writeChangelog = function(stream, commits, version) { |
| 139 | var sections = { |
| 140 | fix: {}, |
| 141 | feat: {}, |
| 142 | perf: {}, |
| 143 | docs: {}, |
| 144 | breaks: {} |
| 145 | }; |
| 146 | |
| 147 | sections.breaks[EMPTY_COMPONENT] = []; |
| 148 | |
| 149 | commits.forEach(function(commit) { |
| 150 | var section = sections[commit.type]; |
| 151 | var component = commit.component || EMPTY_COMPONENT; |
| 152 | |
| 153 | if(section) { |
| 154 | section[component] = section[component] || []; |
| 155 | section[component].push(commit); |
| 156 | } |
| 157 | |
| 158 | if(commit.breaking) { |
| 159 | sections.breaks[component] = sections.breaks[component] || []; |
| 160 | sections.breaks[component].push({ |
| 161 | subject: util.format("due to %s,\n %s", linkToCommit(commit.hash), commit.breaking), |
| 162 | hash: commit.hash, |
| 163 | closes: [] |
| 164 | }); |
| 165 | } |
| 166 | ; |
| 167 | }); |
| 168 | |
| 169 | stream.write(util.format(HEADER_TPL, version, version, currentDate())); |
| 170 | printSection(stream, 'Bug Fixes', sections.fix); |
| 171 | printSection(stream, 'Features', sections.feat); |
| 172 | printSection(stream, 'Performance Improvements', sections.perf); |
| 173 | printSection(stream, 'Documentation', sections.docs); |
| 174 | printSection(stream, 'Breaking Changes', sections.breaks, false); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | var getPreviousTag = function() { |
no test coverage detected