Skip to content

Commit

Permalink
fix: improve the versioning function
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Oct 9, 2023
1 parent feb0e64 commit b09f92e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion runok.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,25 @@ title: ${name}

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

const file = 'CHANGELOG.md';
const changelog = fs.readFileSync(file).toString();

const _changelog = `## ${newVersion}\n
Thanks all to those who contributed to make this release!
🐛 *Bug Fixes*
📖 *Documentation*
🛩️ *Features*
${changelog}`;

fs.writeFileSync(`./${file}`, _changelog);

console.log('Creating and switching to release branch...');
await exec(`git checkout -b release-${newVersion}`);
}
Expand Down

0 comments on commit b09f92e

Please sign in to comment.