From 9db38f5ca23773c2005561116b375dbea4279b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Staltz?= Date: Mon, 5 Jun 2017 20:37:23 +0300 Subject: [PATCH] Support npm5 npm5 installs modules and changes their `package.json`::`version` field to be something like ``` "version": "https://registry.npmjs.org/rn-nodeify/-/rn-nodeify-7.0.1.tgz", ``` instead of ``` "version": "7.0.1", ``` This commit adds support for that first type of string but also supports npm4. --- cmd.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd.js b/cmd.js index 3e98ed4..237c3eb 100755 --- a/cmd.js +++ b/cmd.js @@ -105,7 +105,8 @@ function installShims (modulesToShim, done) { install = false } } else { - var existingVer = pkgJson.version + var existingVerNpm5 = (/\-([^\-]+)\.tgz/.exec(pkgJson.version) || [null, null])[1] + var existingVer = existingVerNpm5 || pkgJson.version if (semver.satisfies(existingVer, allShims[name])) { install = false }