Skip to content

Commit

Permalink
Merge pull request #242 from snyk/fix/debug-log-for-undefined-version…
Browse files Browse the repository at this point in the history
…s-pnpm-lockfile

fix: debug log for undefined version
  • Loading branch information
gemaxim authored Jul 25, 2024
2 parents 8da13d3 + c7bd821 commit 23721ea
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/dep-graph-builders/pnpm/lockfile-parser/lockfile-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
import { valid } from 'semver';
import * as pathUtil from 'path';
import { isEmpty } from 'lodash';
import * as debugModule from 'debug';

const debug = debugModule('snyk-pnpm-workspaces');

export abstract class PnpmLockfileParser {
public lockFileVersion: string;
Expand Down Expand Up @@ -204,7 +207,16 @@ export abstract class PnpmLockfileParser {
.join(importerName || '.', depPath)
.replace(/\\/g, '/');
// cross referenced package, we add it to the extracted packages
version = this.workspaceArgs.projectsVersionMap[resolvedPathDep].version;
const mappedProjInfo =
this.workspaceArgs.projectsVersionMap[resolvedPathDep];
if (!mappedProjInfo) {
debug(
`Importer ${resolvedPathDep} discovered as a dependency of ${importerName} was not found in the lockfile`,
);
version = 'undefined';
} else {
version = mappedProjInfo.version;
}
if (!version) {
version = 'undefined';
}
Expand Down

0 comments on commit 23721ea

Please sign in to comment.