diff mbox series

[master,v2,2/3] fetch2: npmsw: Don't fetch dev dependencies when they are not demanded

Message ID 20230604013919.13904-2-m.belouarga@technologyandstrategy.com
State New
Headers show
Series [master,v2,1/3] bitbake: fetch2: npmsw: Add support for the new format of the shrinkwrap file | expand

Commit Message

belouargamohamed@gmail.com June 4, 2023, 1:39 a.m. UTC
From: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>

Dev dependencies should not be fetched only if it is specified in the
recipe.

Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
---
 lib/bb/fetch2/npmsw.py | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/npmsw.py b/lib/bb/fetch2/npmsw.py
index 359192a29e..d89be10caf 100644
--- a/lib/bb/fetch2/npmsw.py
+++ b/lib/bb/fetch2/npmsw.py
@@ -49,6 +49,8 @@  def foreach_dependencies(shrinkwrap, callback=None, dev=False):
         if package != "":
             name = package.split('node_modules/')[-1]
             package_infos = packages.get(package, {})
+            if dev == False and package_infos.get("dev", False):
+                continue
             callback(name, package_infos, package)
 
 class NpmShrinkWrap(FetchMethod):