diff mbox series

[v3,3/6] npmsw: accept unspecified versions in package.json

Message ID 20240808144824.543208-4-enguerrand.de-ribaucourt@savoirfairelinux.com
State New
Headers show
Series npm: improve fetcher and recipetool compatibility | expand

Commit Message

Enguerrand de Ribaucourt Aug. 8, 2024, 2:48 p.m. UTC
Our current emulation mandates that the package.json contains a version
field. Some packages may not provide it when they are not published to
the registry. The actual `npm pack` would allow such packages, so
should we.

A first commit was required in the npm class.

For the shrinkwrap part , we can actually use the resolved field which
contains the exact source, including the revision, to pass integrity
tests.

v3:
 - Split bitbake npmsw.py modification in another commit

Co-authored-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
Signed-off-by: Tanguy Raufflet <tanguy.raufflet@savoirfairelinux.com>
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
---
 bitbake/lib/bb/fetch2/npmsw.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/npmsw.py b/bitbake/lib/bb/fetch2/npmsw.py
index 018e0ad546..78ce6c3a8d 100644
--- a/bitbake/lib/bb/fetch2/npmsw.py
+++ b/bitbake/lib/bb/fetch2/npmsw.py
@@ -97,7 +97,7 @@  class NpmShrinkWrap(FetchMethod):
 
             integrity = params.get("integrity", None)
             resolved = params.get("resolved", None)
-            version = params.get("version", None)
+            version = params.get("version", resolved)
 
             # Handle registry sources
             if is_semver(version) and integrity: