summaryrefslogtreecommitdiff
path: root/poky/bitbake/lib/bb/fetch2/npm.py
diff options
context:
space:
mode:
Diffstat (limited to 'poky/bitbake/lib/bb/fetch2/npm.py')
-rw-r--r--poky/bitbake/lib/bb/fetch2/npm.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/poky/bitbake/lib/bb/fetch2/npm.py b/poky/bitbake/lib/bb/fetch2/npm.py
index 15f3f19bc8..ac76d64cdb 100644
--- a/poky/bitbake/lib/bb/fetch2/npm.py
+++ b/poky/bitbake/lib/bb/fetch2/npm.py
@@ -42,11 +42,12 @@ from bb.utils import is_semver
def npm_package(package):
"""Convert the npm package name to remove unsupported character"""
- # Scoped package names (with the @) use the same naming convention
- # as the 'npm pack' command.
+ # For scoped package names ('@user/package') the '/' is replaced by a '-'.
+ # This is similar to what 'npm pack' does, but 'npm pack' also strips the
+ # leading '@', which can lead to ambiguous package names.
name = re.sub("/", "-", package)
name = name.lower()
- name = re.sub(r"[^\-a-z0-9]", "", name)
+ name = re.sub(r"[^\-a-z0-9@]", "", name)
name = name.strip("-")
return name