| 137 | }; |
| 138 | |
| 139 | const fetchChangelog = version => { |
| 140 | const parts = version.split('.'); |
| 141 | const releaseLine = parts[0] === '0' ? parts.slice(0, 2).join('') : parts[0]; |
| 142 | |
| 143 | return request({ url: URLS.NODE_CHANGELOG_MD(releaseLine) }).then(data => { |
| 144 | // matches a complete release section |
| 145 | const rxSection = new RegExp( |
| 146 | `<a id="${version}"></a>\\n([\\s\\S]+?)(?:\\n<a id="|$)` |
| 147 | ); |
| 148 | |
| 149 | const matches = rxSection.exec(data); |
| 150 | |
| 151 | return new Promise((resolve, reject) => |
| 152 | matches && matches.length && matches[1] |
| 153 | ? resolve(matches[1].trim()) |
| 154 | : reject(ERRORS.NO_CHANGELOG_FOUND(version)) |
| 155 | ); |
| 156 | }); |
| 157 | }; |
| 158 | |
| 159 | const fetchChangelogBody = version => { |
| 160 | return fetchChangelog(version).then(section => { |
no test coverage detected