Skip to content
Snippets Groups Projects
Unverified Commit 3a6cfacf authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix(versioning/hashicorp): allow v versions from npm (#19841)

parent 98247d34
No related branches found
No related tags found
No related merge requests found
......@@ -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);
});
......
......@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment