Skip to content

Commit af97ec6

Browse files
authored
fix: improve the versioning function (#3911)
1 parent 128274f commit af97ec6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: runok.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,25 @@ title: ${name}
422422

423423
const newVersion = semver.inc(packageFile.version, type);
424424
packageFile.version = newVersion;
425-
fs.writeFileSync('./package.json', JSON.stringify(packageFile, null, 2));
425+
fs.writeFileSync('./package.json', (JSON.stringify(packageFile, null, 2)).replace(/(^[ \t]*\n)/gm, ''));
426426
console.log('Version updated', currentVersion, '=>', newVersion);
427427

428+
const file = 'CHANGELOG.md';
429+
const changelog = fs.readFileSync(file).toString();
430+
431+
const _changelog = `## ${newVersion}\n
432+
Thanks all to those who contributed to make this release!
433+
434+
🐛 *Bug Fixes*
435+
436+
📖 *Documentation*
437+
438+
🛩️ *Features*
439+
440+
${changelog}`;
441+
442+
fs.writeFileSync(`./${file}`, _changelog);
443+
428444
console.log('Creating and switching to release branch...');
429445
await exec(`git checkout -b release-${newVersion}`);
430446
}

0 commit comments

Comments
 (0)