fix: throw 'not implemented' error in buildDepTree for npm v2/v3 lockfiles#200
fix: throw 'not implemented' error in buildDepTree for npm v2/v3 lockfiles#200milahu wants to merge 1 commit into
Conversation
... for npm v2/v3 lockfiles better than 'OutOfSyncError'
|
Does that mean that currently calling buildDepTree is expected to fail for npm v2/v3 lockfiles? |
|
yes, see the readme
|
|
ok so say for the time being I wanted to cover all manifest version I would have to add logic in order to detect manifest/lockfile types/versions and then call either dep-graph or dep-tree? |
|
yes, thats what im doing in my pnpm-install-only const lockfileContent = read(lockfilePath);
const lockfile = JSON.parse(lockfileContent);
const [deps, walk_deps] = (
lockfile.lockfileVersion == 3 ? await getDepgraph(lockfilePath) : // TODO verify
lockfile.lockfileVersion == 2 ? await getDepgraph(lockfilePath) :
lockfile.lockfileVersion == 1 ? await getDeptree(lockfilePath) :
[null, null]
)
if (deps == null && walk_deps == null) {
throw new Error('failed to recognize the lockfile type');
}edit: see also my parse-package-lock |
|
Right, I thought I could use this as a somewhat universal library to parse various lockfile format, so in top what you're doing you'd have to have edge cases for Yarn lockfiles which aren't JSON? EDIT: I realise you have that logic backed into your code so I might get some inspiration from you :-) |
|
yarn lockfiles are not-yet handled by my code other limitations of snyk-nodejs-lockfile-parser:
|
|
Your PR has not had any activity for 60 days. In 7 days I'll close it. Make some activity to remove this. |
|
Your PR has now been stale for 7 days. I'm closing it. |
What this does
throw
not implementederror inbuildDepTreefor npm v2/v3 lockfilesbetter than
OutOfSyncErrorfromgetDependencyTreeproblem in
PackageLockParser.getDepMap:packageLock.dependencies is undefined, it should use packageLock.packages
nodejs-lockfile-parser/lib/parsers/package-lock-parser.ts
Line 110 in 103bb2d
so the
not implementederror is thrown ingetDepMapbefore callingflattenLockfileRecto implement support for v2/v3 npm lockfiles, a good place would be
getDepMapNotes for the reviewer
low priority