Skip to content

Commit

Permalink
fix: some more robust handling of npm list, yarn list, etc...
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthHater committed Dec 10, 2019
1 parent eacad25 commit e5822a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ext-src/packages/npm/NpmDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class NpmDependencies implements PackageDependencies {
Promise.resolve();
}
catch (e) {
Promise.reject();
throw new TypeError(e);
}
}

Expand Down
12 changes: 10 additions & 2 deletions ext-src/packages/npm/NpmUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ export class NpmUtils {
}
});

dependencyList = _.uniqBy(dependencyList, (x) => {
return x.toPurl();
});

return this.sortDependencyList(dependencyList);
}

Expand All @@ -103,7 +107,7 @@ export class NpmUtils {
const name = newSplit[0];
const version = newSplit[1];
if (name != "" && version != undefined) {
return new NpmPackage(name, version, "");
return new NpmPackage(name.replace("%40", "@"), version, "");
}
else {
throw new Error(`No valid information, skipping dependency: ${newName}`);
Expand Down Expand Up @@ -157,12 +161,16 @@ export class NpmUtils {
dependencyList.push(this.setAndReturnNpmPackage(splitParts));
}
catch (e) {
console.debug(e.stderr);
console.debug(e);
}
}
}
});

dependencyList = _.uniqBy(dependencyList, (x) => {
return x.toPurl();
});

return this.sortDependencyList(dependencyList);
}

Expand Down
1 change: 0 additions & 1 deletion ext-src/services/IqRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export class IqRequestService implements RequestService {
auth: { user: this.user, pass: this.password }
},
(err: any, response: any, body: any) => {
// console.log(response.statusCode, body);
if (err) {
reject(`Unable to perform IQ scan: ${err}`);
return;
Expand Down

0 comments on commit e5822a1

Please sign in to comment.