Skip to content

Commit

Permalink
fix(maven): Support versions containing + sign
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Apr 16, 2023
1 parent 09e43ac commit 4f9108b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/modules/versioning/maven/compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ describe('modules/versioning/maven/compare', () => {
${'1-0.alpha'} | ${'1-0.beta'}
${'1_5ea'} | ${'1_c3b'}
${'1_c3b'} | ${'2'}
${'17.0.5'} | ${'17.0.5+8'}
`('$x < $y', ({ x, y }) => {
expect(compare(x, y)).toBe(-1);
expect(compare(y, x)).toBe(1);
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/versioning/maven/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function isDigit(char: string): boolean {
}

function isLetter(char: string): boolean {
return regEx(/^[a-z_]$/i).test(char);
return regEx(/^[a-z_+]$/i).test(char);
}

function isTransition(prevChar: string, nextChar: string): boolean {
Expand Down Expand Up @@ -281,7 +281,7 @@ function isVersion(version: unknown): version is string {
if (!version || typeof version !== 'string') {
return false;
}
if (!regEx(/^[a-z_0-9.-]+$/i).test(version)) {
if (!regEx(/^[-.a-z_+0-9]+$/i).test(version)) {
return false;
}
if (regEx(/^[.-]/).test(version)) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/versioning/maven/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('modules/versioning/maven/index', () => {
test.each`
version | expected
${'1.0.0'} | ${true}
${'17.0.5+8'} | ${true}
${'[1.12.6,1.18.6]'} | ${true}
${undefined} | ${false}
`('isValid("$version") === $expected', ({ version, expected }) => {
Expand Down

0 comments on commit 4f9108b

Please sign in to comment.