Skip to content
Snippets Groups Projects
Unverified Commit 29e865ae authored by Rhys Arkins's avatar Rhys Arkins
Browse files

chore: better hashicorp versioning logging

parent 8e7101e6
No related branches found
No related tags found
No related merge requests found
import { logger } from '../../../logger';
import { regEx } from '../../../util/regex'; import { regEx } from '../../../util/regex';
/** /**
...@@ -16,10 +17,18 @@ export function hashicorp2npm(input: string): string { ...@@ -16,10 +17,18 @@ export function hashicorp2npm(input: string): string {
regEx(/^\s*(|=|!=|>|<|>=|<=|~>)\s*v?((\d+)(\.\d+){0,2}[\w-+]*)\s*$/) regEx(/^\s*(|=|!=|>|<|>=|<=|~>)\s*v?((\d+)(\.\d+){0,2}[\w-+]*)\s*$/)
); );
if (!r) { if (!r) {
throw new Error('invalid hashicorp constraint'); logger.warn(
{ constraint: input, element: single },
'Invalid hashicorp constraint'
);
throw new Error('Invalid hashicorp constraint');
} }
if (r[1] === '!=') { if (r[1] === '!=') {
throw new Error('unsupported != in hashicorp constraint'); logger.warn(
{ constraint: input, element: single },
'Unsupported hashicorp constraint'
);
throw new Error('Unsupported hashicorp constraint');
} }
return { return {
operator: r[1], operator: r[1],
......
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