Skip to content

Commit

Permalink
bug: fix issues with commit message parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Oct 22, 2024
1 parent 5c08af6 commit c249c1d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"homepage": "https://github.com/fauna/typescript#readme",
"dependencies": {
"mentions-regex": "^2.0.3",
"parse-commit-message": "^5.0.4"
}
}
13 changes: 10 additions & 3 deletions scripts/version-bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
const { execSync } = require('node:child_process');
const { parseHeader } = require('parse-commit-message');

const latestCommitMessage = execSync("git log -1 --pretty=%B");
const { type, scope } = parseHeader(latestCommitMessage);
const latestCommitMessage = execSync("git log -1 --pretty=%B", { encoding: "utf-8" });
let flag, type, scope;

try {
console.log("latestCommitMessage", latestCommitMessage);
({ type, scope }) = parseHeader(latestCommitMessage);
} catch (e) {
scope = undefined;
type = undefined;
}

let flag;
if (scope === 'patch' || ['fix', 'chore', 'docs', 'refactor', 'perf', 'test', 'build'].includes(type)) {
flag = '--patch';
} else if (scope === 'minor' || ['feat', 'feature'].includes(type)) {
Expand Down

0 comments on commit c249c1d

Please sign in to comment.