]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
classes-recipe: npm: Complain immediately if npm-shrinkwrap.json is too old
authorMike Crowe <mac@mcrowe.com>
Tue, 8 Apr 2025 13:41:18 +0000 (14:41 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 10 Apr 2025 09:40:39 +0000 (10:40 +0100)
commit4d3cbd11bc9cc0bf5a8571ecd3ce6e5e5c6ef6eb
tree1f86295bef90035422ff16b4b876573b17f3325f
parent4a1671159ec05e9b013a7fd31f65d50302e657e0
classes-recipe: npm: Complain immediately if npm-shrinkwrap.json is too old

Rather than emitting:

 Exception: KeyError: 'packages'

and a stack trace, let's fail immediately if lockfileVersion implies
that the npm-shrinkwrap.json file isn't compatible.

The documentation[1] doesn't make it clear which lockfileVersions are
guaranteed to contain "packages". I have lockfileVersion 1 files
without. Running npm 7.5.2 generates npm-shrinkwrap.json files with
lockfileVersion 2 and "packages", so I've set the minimum to be 2.

[1] https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/npm.bbclass