Skip to content

Commit

Permalink
fix(versioning/hashicorp): allow v versions from npm (#19841)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jan 14, 2023
1 parent 98247d3 commit 3a6cfac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/modules/versioning/hashicorp/convertor.spec.ts
Expand Up @@ -50,6 +50,7 @@ describe('modules/versioning/hashicorp/convertor', () => {
${'~> 4.0'} | ${'~4'}
${'~> 4.0.0'} | ${'~4.0'}
${'~> 4.1.0'} | ${'~4.1'}
${'4.1.0'} | ${'v4.1.0'}
`('npm2hashicorp("$npm") === $hashicorp', ({ hashicorp, npm }) => {
expect(npm2hashicorp(npm)).toBe(hashicorp);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/versioning/hashicorp/convertor.ts
Expand Up @@ -55,7 +55,7 @@ export function npm2hashicorp(input: string): string {
.split(' ')
.map((single) => {
const r = single.match(
regEx(/^(|>|<|>=|<=|~|\^)((\d+)(\.\d+){0,2}[\w-]*)$/)
regEx(/^(|>|<|>=|<=|~|\^)v?((\d+)(\.\d+){0,2}[\w-]*)$/)
);
if (!r) {
throw new Error('invalid npm constraint');
Expand Down

0 comments on commit 3a6cfac

Please sign in to comment.