| 222 | } |
| 223 | |
| 224 | function updateChangelog(nextVersion, commitLog) { |
| 225 | const path = join(ROOT_PATH, CHANGELOG_PATH); |
| 226 | const oldChangelog = readFileSync(path, 'utf8'); |
| 227 | |
| 228 | const [beginning, end] = oldChangelog.split(RELEASE_SCRIPT_TOKEN); |
| 229 | |
| 230 | const dateString = new Date().toLocaleDateString('en-us', { |
| 231 | year: 'numeric', |
| 232 | month: 'long', |
| 233 | day: 'numeric', |
| 234 | }); |
| 235 | const header = `---\n\n### ${nextVersion}\n${dateString}`; |
| 236 | |
| 237 | const newChangelog = `${beginning}${RELEASE_SCRIPT_TOKEN}\n\n${header}\n${commitLog}${end}`; |
| 238 | |
| 239 | console.log(chalk.dim(' Updating changelog: ' + CHANGELOG_PATH)); |
| 240 | |
| 241 | if (!DRY_RUN) { |
| 242 | writeFileSync(path, newChangelog); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | function updateManifestVersions(previousVersion, nextVersion) { |
| 247 | MANIFEST_PATHS.forEach(partialPath => { |