cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kam...@apache.org
Subject [2/8] cordova-lib git commit: Minor cleanup
Date Mon, 23 Mar 2015 22:03:36 GMT
Minor cleanup


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/9b7d9e3f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/9b7d9e3f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/9b7d9e3f

Branch: refs/heads/master
Commit: 9b7d9e3fd46960313a3340ccf2f4bdf281e5b79b
Parents: e70432f
Author: Michal Mocny <mmocny@gmail.com>
Authored: Wed Mar 4 10:17:21 2015 -0500
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Wed Mar 4 10:17:21 2015 -0500

----------------------------------------------------------------------
 cordova-lib/src/cordova/create.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/9b7d9e3f/cordova-lib/src/cordova/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/create.js b/cordova-lib/src/cordova/create.js
index 2153733..4962a75 100644
--- a/cordova-lib/src/cordova/create.js
+++ b/cordova-lib/src/cordova/create.js
@@ -27,8 +27,7 @@ var path          = require('path'),
     CordovaError  = require('../CordovaError'),
     ConfigParser  = require('../configparser/ConfigParser'),
     cordova_util  = require('./util'),
-    validateIdentifier = require('valid-identifier'),
-    _             = require('underscore');
+    validateIdentifier = require('valid-identifier');
 
 /**
  * Usage:
@@ -112,10 +111,13 @@ function create(dir, cfg) {
     })
     .then(function() {
         // Strip link and url from cfg to avoid them being persisted to disk via .cordova/config.json.
-        // TODO: apparently underscore has no deep clone.  Replace with lodash or something.
-        var cfgToPersistToDisk = _.clone(cfg);
-        //delete cfgToPersistToDisk.lib.www;
-        //if (Object.keys(cfgToPersistToDisk.lib).length === 0) delete cfgToPersistToDisk.lib;
+        // TODO: apparently underscore has no deep clone.  Replace with lodash or something.
For now, abuse JSON.
+        var cfgToPersistToDisk = JSON.parse(JSON.stringify(cfg));
+
+        delete cfgToPersistToDisk.lib.www;
+        if (Object.keys(cfgToPersistToDisk.lib).length === 0) {
+            delete cfgToPersistToDisk.lib;
+        }
 
         // Update cached version of config.json
         var origAutoPersist = config.getAutoPersist();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message