Skip to content

Commit

Permalink
Comment on stripping only version or tag from package name arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Dillon committed Oct 3, 2016
1 parent 33f9731 commit d9ed896
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ function getInstallPackage(version) {

// Extract package name from tarball url or path.
function getPackageName(installPackage) {
if (installPackage.indexOf('.tgz') > 0) {
if (installPackage.indexOf('.tgz') > -1) {
return installPackage.match(/^.+\/(.+)-.+\.tgz$/)[1];
} 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 d9ed896

Please sign in to comment.