Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 57BC3200C46 for ; Wed, 22 Feb 2017 01:07:35 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 5333B160B88; Wed, 22 Feb 2017 00:07:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A1955160B7C for ; Wed, 22 Feb 2017 01:07:34 +0100 (CET) Received: (qmail 87033 invoked by uid 500); 22 Feb 2017 00:07:33 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 86835 invoked by uid 99); 22 Feb 2017 00:07:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2017 00:07:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B6AE7DFA3D; Wed, 22 Feb 2017 00:07:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Wed, 22 Feb 2017 00:07:37 -0000 Message-Id: In-Reply-To: <20186d175ed942b3af983b9b50cc599a@git.apache.org> References: <20186d175ed942b3af983b9b50cc599a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/32] cordova-lib git commit: fixfetch : updated index.js to deal with local path archived-at: Wed, 22 Feb 2017 00:07:35 -0000 fixfetch : updated index.js to deal with local path Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/e5efb1a9 Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/e5efb1a9 Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/e5efb1a9 Branch: refs/heads/master Commit: e5efb1a92a10f3e179618354373b0a51975f6588 Parents: b3ca300 Author: Audrey So Authored: Wed Feb 15 10:10:32 2017 -0800 Committer: Audrey So Committed: Wed Feb 15 10:19:39 2017 -0800 ---------------------------------------------------------------------- cordova-fetch/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e5efb1a9/cordova-fetch/index.js ---------------------------------------------------------------------- diff --git a/cordova-fetch/index.js b/cordova-fetch/index.js index ba95280..21c2f42 100644 --- a/cordova-fetch/index.js +++ b/cordova-fetch/index.js @@ -51,14 +51,12 @@ module.exports = function(target, dest, opts) { //append node_modules to dest if it doesn't come included if (path.basename(dest) !== 'node_modules') { - dest = path.resolve(path.join(dest, 'node_modules')); + dest = path.resolve(path.join(dest, 'node_modules')); } - //create dest if it doesn't exist if(!fs.existsSync(dest)) { shell.mkdir('-p', dest); } - } else return Q.reject(new CordovaError('Need to supply a target and destination')); //set the directory where npm install will be run @@ -70,7 +68,6 @@ module.exports = function(target, dest, opts) { fetchArgs.push('--save'); } - //Grab json object of installed modules before npm install return depls(dest); }) @@ -140,7 +137,6 @@ function getJsonDiff(obj1, obj2) { */ function trimID(target) { var parts; - //If GITURL, set target to repo name if (isUrl(target)) { //strip away .git and everything that follows @@ -151,6 +147,11 @@ function trimID(target) { target = parts[1]; } + + //If local path exists, set target to final directory + if (fs.existsSync(target)) { + target = path.basename(target); + } //strip away everything after '@' //also support scoped packages --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org