|
114 | 114 | "COMPOSER": "composer", |
115 | 115 | "PIP": "pypi", |
116 | 116 | "RUBYGEMS": "gem", |
| 117 | + "NPM": "npm", |
117 | 118 | # "GO": "golang", |
118 | 119 | } |
119 | 120 |
|
|
122 | 123 | } |
123 | 124 |
|
124 | 125 | # TODO: We will try to gather more info from GH API |
| 126 | +# Check https://github.com/nexB/vulnerablecode/issues/1039#issuecomment-1366458885 |
125 | 127 | # Check https://github.com/nexB/vulnerablecode/issues/645 |
126 | | -# set of all possible values of first '%s' = {'MAVEN','COMPOSER', 'NUGET', 'RUBYGEMS', 'PYPI'} |
| 128 | +# set of all possible values of first '%s' = {'MAVEN','COMPOSER', 'NUGET', 'RUBYGEMS', 'PYPI', 'NPM'} |
127 | 129 | # second '%s' is interesting, it will have the value '' for the first request, |
128 | 130 | GRAPHQL_QUERY_TEMPLATE = """ |
129 | 131 | query{ |
@@ -202,13 +204,13 @@ def get_purl(pkg_type: str, github_name: str) -> Optional[PackageURL]: |
202 | 204 | ns, _, name = github_name.partition(":") |
203 | 205 | return PackageURL(type=pkg_type, namespace=ns, name=name) |
204 | 206 |
|
205 | | - if pkg_type == "composer": |
| 207 | + if pkg_type in ("composer", "npm"): |
206 | 208 | if "/" not in github_name: |
207 | 209 | return PackageURL(type=pkg_type, name=github_name) |
208 | 210 | vendor, _, name = github_name.partition("/") |
209 | 211 | return PackageURL(type=pkg_type, namespace=vendor, name=name) |
210 | 212 |
|
211 | | - if pkg_type in ("nuget", "pypi", "gem", "golang"): |
| 213 | + if pkg_type in ("nuget", "pypi", "gem", "golang", "npm"): |
212 | 214 | return PackageURL(type=pkg_type, name=github_name) |
213 | 215 |
|
214 | 216 | logger.error(f"get_purl: Unknown package type {pkg_type}") |
|
0 commit comments