mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-12 02:34:18 +00:00
feat: change minor pattern to support optional conventional commit scopes
The Conventional Commits spec allows optional scopes to be present after the change type, e.g. `feat(scope):`. The current minor pattern will only bump the minor version number if the pattern exactly matches `feat:`. This change is backwards compatible and adds support for these scopes.
This commit is contained in:
parent
7bf8143b3b
commit
67c95513f8
6 changed files with 21 additions and 7 deletions
|
|
@ -13,7 +13,7 @@ export class ActionConfig {
|
|||
/** A string which indicates the flags used by the `majorPattern` regular expression. */
|
||||
public majorFlags: string = "";
|
||||
/** A string which, if present in a git commit, indicates that a change represents a minor (feature) change. Wrap with '/' to match using a regular expression. */
|
||||
public minorPattern: string = "/feat:/";
|
||||
public minorPattern: string = "/^feat(\(.+\))?:/";
|
||||
/** A string which indicates the flags used by the `minorPattern` regular expression. */
|
||||
public minorFlags: string = "";
|
||||
/** Pattern to use when formatting output version */
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ program
|
|||
.option(
|
||||
"-m, --minor-pattern <pattern>",
|
||||
"Regex pattern for minor version bumps",
|
||||
"/feat:/",
|
||||
"/^feat(\(.+\))?:/",
|
||||
)
|
||||
.option("--minor-flags <flags>", "Flags for minor pattern regex", "")
|
||||
.option(
|
||||
|
|
|
|||
|
|
@ -217,6 +217,20 @@ testInterfaces.forEach((testInterface) => {
|
|||
timeout,
|
||||
);
|
||||
|
||||
test(
|
||||
"Minor commits with conventional commit scopes bump minor version",
|
||||
async () => {
|
||||
const repo = createTestRepo(testRunner); // 0.0.0+0
|
||||
|
||||
repo.makeCommit("Initial Commit"); // 0.0.1+0
|
||||
repo.makeCommit("feat(scope): Second Commit"); // 0.1.0+0
|
||||
const result = await repo.runAction();
|
||||
|
||||
expect(result.formattedVersion).toBe("0.1.0+0");
|
||||
},
|
||||
timeout,
|
||||
);
|
||||
|
||||
test(
|
||||
"Tags start new version",
|
||||
async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue