From 58cbe650607fd39865013cb07289a1a7dde779ff Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 29 Oct 2015 14:16:17 +1100 Subject: [PATCH] Allow the other types of URLs that npm supports. See for instance #844 for people running into the fact that our lack of support for git protocols means dealing with private npm packages is a pain. --- tools/utils/utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/utils/utils.js b/tools/utils/utils.js index accdb47267..856c47b8a9 100644 --- a/tools/utils/utils.js +++ b/tools/utils/utils.js @@ -477,9 +477,10 @@ exports.isUrlWithFileScheme = function (x) { }; exports.isUrlWithSha = function (x) { - // For now, just support http/https, which is at least less restrictive than - // the old "github only" rule. - return /^https?:\/\/.*[0-9a-f]{40}/.test(x); + // These are the various protocols that NPM supports, which we use to download + // both NPM and Cordova dependencies + // See https://docs.npmjs.com/files/package.json#git-urls-as-dependencies + return /^(https|git|git\+ssh|git\+http|git\+https)?:\/\/.*[0-9a-f]{40}/.test(x); }; exports.isPathRelative = function (x) {