diff --git a/scripts/version-bump.js b/scripts/version-bump.js index 701539f..f2d9a13 100755 --- a/scripts/version-bump.js +++ b/scripts/version-bump.js @@ -4,10 +4,9 @@ const { execSync } = require('node:child_process'); const { parseHeader } = require('parse-commit-message'); const latestCommitMessage = execSync("git log -1 --pretty=%B", { encoding: "utf-8" }); -let flag, type, scope; +let versionType, type, scope; try { - console.log("latestCommitMessage", latestCommitMessage); const header = parseHeader(latestCommitMessage); type = header.type; scope = header.scope; @@ -17,13 +16,14 @@ try { } if (scope === 'patch' || ['fix', 'chore', 'docs', 'refactor', 'perf', 'test', 'build'].includes(type)) { - flag = '--patch'; + versionType = '--patch'; } else if (scope === 'minor' || ['feat', 'feature'].includes(type)) { - flag = '--minor'; + versionType = '--minor'; } else if (scope === 'major') { - flag = '--major'; + versionType = '--major'; } else { - flag = '--patch'; + versionType = '--patch'; } -execSync(`npm version ${flag}`); +console.log(`Parsed commit message:\n${latestCommitMessage}\n\nDetermined the version as ${versionType} (from scope ${scope} and change type ${type}).\n`); +console.log(execSync(`npm version ${versionType}`, { encoding: "utf-8" }));