Support version tags that don't start with v for semantic versioning (#303)
* Fixes #242 * Update semver version * Update husky * Update husky pre-commit hook * Update dependencies * Update dependencies * Remove git add since changes will be automatically added * Restore git add * Update dependencies * Update test
This commit is contained in:
@@ -128,6 +128,13 @@ describe('Versioning', () => {
|
||||
},
|
||||
);
|
||||
|
||||
test.each(['1.1-1-g12345678', '0.1-2-g12345678', '0.0-500-gA9B6C3D0-dirty'])(
|
||||
'accepts valid semantic versions without v-prefix %s',
|
||||
(description) => {
|
||||
expect(Versioning.descriptionRegex1.test(description)).toBeTruthy();
|
||||
},
|
||||
);
|
||||
|
||||
test.each(['v0', 'v0.1', 'v0.1.2', 'v0.1-2', 'v0.1-2-g'])('does not like %s', (description) => {
|
||||
expect(Versioning.descriptionRegex1.test(description)).toBeFalsy();
|
||||
// Also never expect without the v to work for any of these cases.
|
||||
|
||||
@@ -68,15 +68,15 @@ export default class Versioning {
|
||||
* Regex to parse version description into separate fields
|
||||
*/
|
||||
static get descriptionRegex1() {
|
||||
return /^v([\d.]+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||
return /^v?([\d.]+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||
}
|
||||
|
||||
static get descriptionRegex2() {
|
||||
return /^v([\d.]+-\w+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||
return /^v?([\d.]+-\w+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||
}
|
||||
|
||||
static get descriptionRegex3() {
|
||||
return /^v([\d.]+-\w+\.\d+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||
return /^v?([\d.]+-\w+\.\d+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||
}
|
||||
|
||||
static async determineVersion(strategy: string, inputVersion: string) {
|
||||
|
||||
Reference in New Issue
Block a user