Open mohsen1 opened 4 years ago
I think that would make sense, yes. Do you want to provide a PR? 😇
But "npm version patch" commits without the v prefix like "0.0.1"
I think the below expression may be helpful:
^v?(\d+\.\d+\.\d+(?:-(?:alpha|beta)\.\d+)?)$
Features:
v
prefix is optional but supportedalpha
and beta
commit messages but requires a numeric subfix (-alpha.0
)Before | After |
---|---|
v1.2.3 |
1.2.3 |
1.2.3 |
1.2.3 |
v11.12.13 |
11.12.13 |
11.12.13 |
11.12.13 |
11.12.13-alpha.10 |
11.12.13-alpha.10 |
v1.2.3-alpha.0 |
1.2.3-alpha.0 |
1.2.3-alpha.0 |
1.2.3-alpha.0 |
v1.2.3-beta.0 |
1.2.3-beta.0 |
Non matches:
x1.2.3
, x1.2.3-gamma
, x11.12.13
, v1.2.3-alpha
You can find *unit* tests for it at https://regexr.com/589ii
@pascalgn Do you want me to make a PR for this Regex? If yes, do you want me to add unit tests with mocha/chai?
Yes, feel free to create a PR! Adding a unit test should be fine, too!
I use the default worflow of yarn for making a new release:
yarn version --new-version patch
This makes a commit with message like
v0.0.1
Currently I have to update the commit message to say
Release v0.0.1
or change the configuration of this action.Although very minor, it would be nice for that to simply work.