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