Skip to content

Commit

Permalink
more fine-tuning of the commit analyzer
Browse files Browse the repository at this point in the history
With  a small modification to the regular expression that matches the
commit message header we should
be able to force the first word to be
captured as the type.
  • Loading branch information
line-o committed Apr 20, 2024
1 parent cb232da commit 41f89f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "conventionalcommits",
"parserOpts": "./commit-parser-options.js",
"releaseRules": [
{ "type": "!(fix|feat|build|chore|ci|docs|style|refactor|perf|test)", "release": "patch" }
]
Expand Down
7 changes: 7 additions & 0 deletions commit-parser-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Change default header pattern matcher to match headers with no colon.
// This will make the first __word__ in free-form commit message headers the __type__.
// With this non-empty type we can do a negated match (the type being anything but
// one of the other keywords with associated release rules).
module.exports = {
"headerPattern": /^(\w*)(?:\(([\w\$\.\-\* ]*)\))?\:? (.*)$/
};

0 comments on commit 41f89f4

Please sign in to comment.