Skip to content

Commit

Permalink
Support resolutions in npm package.json
Browse files Browse the repository at this point in the history
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed Jun 19, 2024
1 parent ae22b45 commit 5536ede
Show file tree
Hide file tree
Showing 4 changed files with 444 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/packagedcode/npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,11 @@ def deps_mapper(deps, package, field_name, is_direct=True):
deps_by_name[npm_name] = d

for fqname, requirement in deps.items():
# Handle cases in ``resolutions`` with ``**``
# "resolutions": {
# "**/@typescript-eslint/eslint-plugin": "^4.1.1",
if fqname.startswith('**'):
fqname = fqname.replace('**', '')
ns, name = split_scoped_package_name(fqname)
if not name:
continue
Expand Down
44 changes: 44 additions & 0 deletions tests/packagedcode/data/npm/with_resolutions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"homepage": "https://jonghwapark.github.io/brawler/",
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/classnames": "^2.2.11",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.9",
"@types/react-router-dom": "^5.1.6",
"gh-pages": "^3.1.0",
"http-proxy-middleware": "^1.1.0",
"immutable": "^4.0.0-rc.12",
"node-sass": "^4.14.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-native-web": "^0.16.3",
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-router-redux": "^4.0.8",
"react-scripts": "3.4.3",
"redux-saga": "^1.1.3",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^2.0.0",
"typescript": "^4.1.3"
},
"devDependencies": {
"axios": "^0.20.0",
"classnames": "^2.2.6",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8"
},
"resolutions": {
"**/@typescript-eslint/eslint-plugin": "^4.1.1",
"**/@typescript-eslint/parser": "^4.1.1"
}
}

Loading

0 comments on commit 5536ede

Please sign in to comment.