cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [06/32] cordova-lib git commit: fixfetch : updated index.js to deal with local path
Date Wed, 22 Feb 2017 00:07:37 GMT
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 <audreyso@apache.org>
Authored: Wed Feb 15 10:10:32 2017 -0800
Committer: Audrey So <audreyso@apache.org>
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


Mime
View raw message