cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From audre...@apache.org
Subject cordova-lib git commit: CB-13463 : prevent package.json update plugins with --nosave
Date Wed, 25 Oct 2017 17:34:19 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 93a75f520 -> e8fec2519


CB-13463 : prevent package.json update plugins with --nosave


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

Branch: refs/heads/master
Commit: e8fec2519d6082b02f349408b147a04ebd020c87
Parents: 93a75f5
Author: Audrey So <audreyso@apache.org>
Authored: Fri Oct 20 14:10:26 2017 -0700
Committer: Audrey So <audreyso@apache.org>
Committed: Tue Oct 24 16:57:42 2017 -0700

----------------------------------------------------------------------
 integration-tests/pkgJson-restore.spec.js | 22 +++++++++++-----------
 src/cordova/restore-util.js               |  4 ++--
 2 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e8fec251/integration-tests/pkgJson-restore.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/pkgJson-restore.spec.js b/integration-tests/pkgJson-restore.spec.js
index d48581f..ed1ffd4 100644
--- a/integration-tests/pkgJson-restore.spec.js
+++ b/integration-tests/pkgJson-restore.spec.js
@@ -262,7 +262,7 @@ describe('tests platform/spec restore with --save', function () {
             return cordovaPlatform('add', 'browser', {'save': true, 'fetch': true});
         }).then(function () {
             // Run cordova prepare with fetch.
-            return prepare({'fetch': true});
+            return prepare({'save': true, 'fetch': true});
         }).then(function () {
             // Config.xml spec is modified.
             var cfg3 = new ConfigParser(configXmlPath);
@@ -762,7 +762,7 @@ describe('update config.xml to use the variable found in pkg.json', function
()
 
         emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare({'fetch': true});
+            return prepare({'fetch': true, 'save':true});
         }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -847,7 +847,7 @@ describe('update pkg.json to include plugin and variable found in config.xml',
f
 
         emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare({'fetch': true});
+            return prepare({'fetch': true, 'save': true});
         }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -949,7 +949,7 @@ describe('update pkg.json AND config.xml to include all plugins and merge
unique
 
         emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare({'fetch': true});
+            return prepare({'fetch': true, 'save': true});
         }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -981,9 +981,9 @@ describe('update pkg.json AND config.xml to include all plugins and merge
unique
             expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toEqual({ variable_1:
' ', variable_2: ' ', variable_3: 'value_3' });
             // Expect config.xml to have the plugins from pkg.json.
             expect(Object.keys(configPlugins).length === 3);
-            expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(0);
+            expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(2);
             expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(1);
-            expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(2);
+            expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(0);
             // Expect all 3 plugins to be restored.
             expect(path.join(pluginsFolderPath13, 'cordova-plugin-device')).toExist();
             expect(path.join(pluginsFolderPath13, 'cordova-plugin-camera')).toExist();
@@ -1079,7 +1079,7 @@ describe('update pkg.json AND config.xml to include all plugins/merge
variables
 
         emptyPlatformList().then(function () {
             // Run cordova prepare
-            return prepare({'fetch': true});
+            return prepare({'save': true});
         }).then(function () {
             // Delete any previous caches of require(package.json)
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);
@@ -1110,9 +1110,9 @@ describe('update pkg.json AND config.xml to include all plugins/merge
variables
             }
             // Config.xml now has the camera, splashscreen, and device plugin
             expect(Object.keys(configPlugins).length === 3);
-            expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(0);
-            expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(1);
-            expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(2);
+            expect(configPlugins.indexOf('cordova-plugin-splashscreen')).toEqual(2);
+            expect(configPlugins.indexOf('cordova-plugin-camera')).toEqual(0);
+            expect(configPlugins.indexOf('cordova-plugin-device')).toEqual(1);
             // Pkg.json has all 3 plugins with the correct specs
             expect(Object.keys(pkgJson.cordova.plugins).length === 3);
             expect(pkgJson.cordova.plugins['cordova-plugin-camera']).toBeDefined();
@@ -1199,7 +1199,7 @@ describe('update config.xml to include the plugin that is in pkg.json',
function
 
         emptyPlatformList().then(function () {
             // Run cordova prepare.
-            return prepare({'fetch': true});
+            return prepare({'fetch': false, 'save':true});
         }).then(function () {
             // Delete any previous caches of require(package.json).
             pkgJson = cordova_util.requireNoCache(pkgJsonPath);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e8fec251/src/cordova/restore-util.js
----------------------------------------------------------------------
diff --git a/src/cordova/restore-util.js b/src/cordova/restore-util.js
index bd4b66d..012de2f 100644
--- a/src/cordova/restore-util.js
+++ b/src/cordova/restore-util.js
@@ -329,7 +329,7 @@ function installPluginsFromConfigXML (args) {
             }
         });
         // If pkg.json plugins have been modified, write to it.
-        if (modifiedPkgJson === true) {
+        if (modifiedPkgJson === true && args.save !== false) {
             pkgJson.cordova.plugins = comboObject;
             if (pkgJson.dependencies === undefined) {
                 pkgJson.dependencies = {};
@@ -366,7 +366,7 @@ function installPluginsFromConfigXML (args) {
         }
     });
 
-    if (modifiedConfigXML === true) {
+    if (modifiedConfigXML === true && args.save !== false) {
         cfg.write();
     }
 


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


Mime
View raw message