Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 1359cc4

Browse files
pdillongaearon
authored andcommitted
Support passing scoped package names to --scripts-version arg (#826)
* Support passing scoped package names to --scripts-version arg * Factor out bitwise operator in indexOf test * Comment on stripping only version or tag from package name arg
1 parent 3539d04 commit 1359cc4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/create-react-app/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,11 @@ function getInstallPackage(version) {
152152

153153
// Extract package name from tarball url or path.
154154
function getPackageName(installPackage) {
155-
if (~installPackage.indexOf('.tgz')) {
155+
if (installPackage.indexOf('.tgz') > -1) {
156156
return installPackage.match(/^.+\/(.+)-.+\.tgz$/)[1];
157-
} else if (~installPackage.indexOf('@')) {
158-
return installPackage.split('@')[0];
157+
} else if (installPackage.indexOf('@') > 0) {
158+
// Do not match @scope/ when stripping off @version or @tag
159+
return installPackage.charAt(0) + installPackage.substr(1).split('@')[0];
159160
}
160161
return installPackage;
161162
}

0 commit comments

Comments
 (0)