Skip to content

Commit

Permalink
* package-lock.json parser will fix sub-dependencies names
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandrbig committed Apr 1, 2024
1 parent 843a2b5 commit 3c9cdd1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## 3.3.3 - 2024-04-01

### Fixed
* package-lock.json parser will fix sub-dependencies names


## 3.3.2 - 2024-03-29

### Changed
Expand Down
7 changes: 4 additions & 3 deletions lib/npm-scanner.js
Expand Up @@ -146,9 +146,9 @@ Scanner.prototype.walk = function walk(npmDependency, level, root) {

printDependency(npmDependency, level);
if (npmDependency.name) {
let pkg = root && root.packages && root.packages[`node_modules/${npmDependency.name}`];
let pkg = root && root.packages && root.packages[`node_modules/${npmDependency.fullName || npmDependency.name}`];
if (!pkg) {
pkg = root && root.packages && root.packages[''];
pkg = root && root.packages && root.packages[''];
}
let repository = npmDependency.repository && npmDependency.repository.url;
if (!repository) {
Expand Down Expand Up @@ -177,7 +177,8 @@ Scanner.prototype.walk = function walk(npmDependency, level, root) {
const childDependency = npmDependency.packages[val];
if (childDependency) {
const parts = val.split('node_modules/');
childDependency.name = parts.length > 1 ? parts.slice(1).join('node_modules/') : parts[0];
childDependency.name = parts.length > 1 ? parts[parts.length-1] : parts[0];
childDependency.fullName = parts.length > 1 ? parts.slice(1).join('node_modules/') : parts[0];
}
checkForChild(self, opts, dependency, childDependency, val, level, root);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "ts-node-client",
"description": "npm / node module to transfer dependency information to TrustSource server.",
"version": "3.3.2",
"version": "3.3.3",
"homepage": "https://app.trustsource.io/",
"author": {
"name": "Oleksandr Dmukhovskyi",
Expand Down

0 comments on commit 3c9cdd1

Please sign in to comment.