Skip to content

Commit

Permalink
Support passing scoped package names to --scripts-version arg (facebo…
Browse files Browse the repository at this point in the history
…ok#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
  • Loading branch information
pdillon authored and jarlef committed Nov 28, 2016
1 parent 7bcd712 commit d274675
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ function getInstallPackage(version) {

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

0 comments on commit d274675

Please sign in to comment.