Skip to content

Commit

Permalink
fix: use correct npm version syntax in script
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Oct 22, 2024
1 parent 8311a3c commit 73e978b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/version-bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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" }));

0 comments on commit 73e978b

Please sign in to comment.