Commit 1359cc49 authored by Patrick Dillon's avatar Patrick Dillon Committed by Dan Abramov
Browse files

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
parent 3539d040
Showing with 4 additions and 3 deletions
+4 -3
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment