cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cordova-lib git commit: CB-9177 Use tilde instead of caret when save to config.xml.
Date Sun, 14 Jun 2015 22:19:15 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 921dad392 -> 6b768adc3


CB-9177 Use tilde instead of caret when save to config.xml.

Also ensures 'platform save' saves version with tilde.


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

Branch: refs/heads/master
Commit: 6b768adc3e9bf68a6ca9945c301494b9d3e124d4
Parents: 921dad3
Author: Tim Barham <tim.barham@microsoft.com>
Authored: Sun Jun 14 14:26:07 2015 -0700
Committer: Tim Barham <tim.barham@microsoft.com>
Committed: Sun Jun 14 14:45:38 2015 -0700

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 12 +++++++++---
 cordova-lib/src/cordova/plugin.js   |  4 ++--
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6b768adc/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 2e6f204..6f56dd8 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -186,8 +186,8 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
 
                     if(opts.save || autosave){
                         // Similarly here, we save the source location if that was specified,
otherwise the version that
-                        // was installed. However, we save it with the "^" attribute.
-                        spec = saveVersion ? '^' + platDetails.version : spec;
+                        // was installed. However, we save it with the "~" attribute (this
allows for patch updates).
+                        spec = saveVersion ? '~' + platDetails.version : spec;
 
                         // Save target into config.xml, overriding already existing settings
                         events.emit('log', '--save flag or autosave detected');
@@ -216,12 +216,18 @@ function save(hooksRunner, projectRoot, opts) {
     // Save installed platforms into config.xml
     return platformMetadata.getPlatformVersions(projectRoot).then(function(platformVersions){
         platformVersions.forEach(function(platVer){
-            cfg.addEngine(platVer.platform, platVer.version);
+            cfg.addEngine(platVer.platform, getSpecString(platVer.version));
         });
         cfg.write();
     });
 }
 
+function getSpecString(spec) {
+    var validVersion = semver.valid(spec, true);
+    return validVersion ? '~' + validVersion : spec;
+
+}
+
 // Downloads via npm or via git clone (tries both)
 // Returns a Promise
 function downloadPlatform(projectRoot, platform, version, opts) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6b768adc/cordova-lib/src/cordova/plugin.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/plugin.js b/cordova-lib/src/cordova/plugin.js
index d0c366b..785a9c3 100644
--- a/cordova-lib/src/cordova/plugin.js
+++ b/cordova-lib/src/cordova/plugin.js
@@ -147,7 +147,7 @@ module.exports = function plugin(command, targets, opts) {
                             attributes.name = pluginInfo.id;
 
                             var src = parseSource(target, opts);
-                            attributes.spec = src ? src : '^' + pluginInfo.version;
+                            attributes.spec = src ? src : '~' + pluginInfo.version;
 
                             var variables = [];
                             if (opts.cli_variables) {
@@ -481,7 +481,7 @@ function getSpec(pluginSource, projectRoot, pluginName) {
 function versionString(version) {
     var validVersion = semver.valid(version, true);
     if (validVersion) {
-        return '^' + validVersion;
+        return '~' + validVersion;
     }
 
     if (semver.validRange(version, true)) {


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


Mime
View raw message