Skip to content

Commit

Permalink
feat(release): Write changelog to a temp file so it can be edited whi…
Browse files Browse the repository at this point in the history
…le the release script is paused
  • Loading branch information
christopherthielen committed Oct 2, 2019
1 parent 60f811c commit 9cce8fd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion release.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ if (readlineSync.keyInYN('\n\nUpdate CHANGELOG?')) {
console.log('CHANGELOG:\n\n');
console.log(changelog);

const tempChangelogFile = `CHANGELOG.md.${version}`;
fs.writeFileSync(tempChangelogFile, changelog);

console.log(`Wrote changelog to temp file: ${tempChangelogFile}`);
if (!readlineSync.keyInYN('Does the CHANGELOG look OK?')) {
process.exit(1);
}

let fullChangelog = fs.readFileSync('CHANGELOG.md');
fs.writeFileSync('CHANGELOG.md', changelog + '\n' + fullChangelog);
let newChangelog = fs.readFileSync(tempChangelogFile);
fs.writeFileSync('CHANGELOG.md', newChangelog + '\n' + fullChangelog);
fs.unlinkSync(tempChangelogFile);
modifiedFiles.push('CHANGELOG.md');
}

Expand Down

0 comments on commit 9cce8fd

Please sign in to comment.