@@ -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
The '@types/ramda' [1] npm package has recently gained a dependency on the 'types-ramda' [2] npm package. Both have the same version number. The name mangling results in the tarballs of both packages sharing the same name, but different contents. Fix that by accepting '@' as valid character in the package name, resulting in one package named @types-ramda and one called types-ramda. [1]: https://www.npmjs.com/package/@types/ramda [2]: https://www.npmjs.com/package/types-ramda Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de> --- lib/bb/fetch2/npm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)