Skip to content

Npm scoped packages with . produces incorrect package name for Android #1031

@elvinas-engagecraft

Description

@elvinas-engagecraft

Environment

System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 92.13 MB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.17.0 - /var/folders/0p/361s5djn5j5gxw68jcb_kh_c0000gn/T/yarn--1583241745457-0.7168462120011501/node
    Yarn: 1.22.0 - /var/folders/0p/361s5djn5j5gxw68jcb_kh_c0000gn/T/yarn--1583241745457-0.7168462120011501/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

Description

#910 PR introduced an issue with npm scopes that have a dot (.) char, e.g. @bam.tech/react-native-snap-carousel. The regexp '^@([\\w-]+)/ works with word \W and the - chars as the npm scope only.

So the regexp should include a dot char (e.g. '^@([\\w-.]+)/). Or dots may be replaced with dashes (-).

I've tried to use a regexp with dot and everything worked fine.

Reproducible Demo

Add a scoped dependency (scope has a . char)
yarn add @bam.tech/react-native-snap-carousel

Build Android app, e.g.
./gradlew installRelease

You'll get an error

FAILURE: Build failed with an exception.

* What went wrong:

A problem occurred configuring project ':@bam.tech/react-native-snap-carousel'.
> The project name '@bam.tech/react-native-snap-carousel' must not contain any of the following characters: [/, \, :, <, >, ", ?, *, |]. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/5.6.4/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions