From 3a6cfacfbadec047fa2fd093dbfa445f03b67278 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sat, 14 Jan 2023 09:52:20 +0100 Subject: [PATCH] fix(versioning/hashicorp): allow v versions from npm (#19841) --- lib/modules/versioning/hashicorp/convertor.spec.ts | 1 + lib/modules/versioning/hashicorp/convertor.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/modules/versioning/hashicorp/convertor.spec.ts b/lib/modules/versioning/hashicorp/convertor.spec.ts index 29e682fcc7..bd3ed56e47 100644 --- a/lib/modules/versioning/hashicorp/convertor.spec.ts +++ b/lib/modules/versioning/hashicorp/convertor.spec.ts @@ -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); }); diff --git a/lib/modules/versioning/hashicorp/convertor.ts b/lib/modules/versioning/hashicorp/convertor.ts index 5dabfb5414..cf5ba17cdb 100644 --- a/lib/modules/versioning/hashicorp/convertor.ts +++ b/lib/modules/versioning/hashicorp/convertor.ts @@ -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'); -- GitLab