Skip to content

Commit

Permalink
fix(npm): remove invalid extractedConstraints (#24465)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored Sep 18, 2023
1 parent 6282904 commit 1721e8c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts engine
"npm": "^8.0.0",
"pnpm": "^1.2.0",
"vscode": ">=1.49.3",
"yarn": "disabled",
},
"managerData": {
"hasPackageManager": false,
Expand Down
1 change: 0 additions & 1 deletion lib/modules/manager/npm/extract/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ describe('modules/manager/npm/extract/index', () => {
npm: '^8.0.0',
pnpm: '^1.2.0',
vscode: '>=1.49.3',
yarn: 'disabled',
},
deps: [
{ depName: 'angular', currentValue: '1.6.0' },
Expand Down
9 changes: 9 additions & 0 deletions lib/modules/manager/npm/extract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ export async function extractPackageFile(
}
}

for (const [constraintName, constaintValue] of Object.entries(
extractedConstraints
)) {
// delete any extracted constraints which aren't valid semver ranges
if (!isValid(constaintValue)) {
delete extractedConstraints[constraintName];
}
}

return {
deps,
packageFileVersion,
Expand Down

0 comments on commit 1721e8c

Please sign in to comment.