GitHub user TimBarham opened a pull request:

    https://github.com/apache/cordova-lib/pull/244

    CB-9147 Adding a platform via caret version adds wrong version

    It adds the very latest version rather than the latest matching version.
    
    Internally we are using a version of `npm` that doesn't understand caret 
versions, so it just gets the latest. I missed this previously because when I 
tried this, the latest version **was also** the latest matching version.
    
    The same problem also applies to plugins.
    
    I've made a slightly different fix in each case:
    
    For platforms, we already had the latest matching version as a result of 
our call to `getLatestMatchingNpmVersion()`, so I just use that.
    
    For plugins, in this specific scenario (a caret version) I turn it into a 
standard range using a version of `semver` that understands caret ranges (so 
`^1.2.3` becomes `>=1.2.3 <2.0.0`) and use that instead.
    
    Note that this is currently an issue with platforms and plugin versions 
saved to `config.xml`.
    
    Also, I noticed that we failed to find the version in `config.xml` if you 
added it using the new form (`cordova-plugin-camera`, for example), but it was 
stored in `config.xml` using the id, so fixed that.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-lib CB-9147

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/244.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #244
    
----
commit 025127916530de530dccaeb98b2b9a9bc8df8e2a
Author: Tim Barham <[email protected]>
Date:   2015-06-09T22:20:13Z

    CB-9147 Adding a platform via caret version adds latest rather than the 
latest matching.
    
    Internally we are using a version of npm that doesn't understand caret 
versions, so it just gets the latest. Missed this previously because when I 
tried this, the latest version *was* the latest matching version.
    
    The same problem also applies to plugins.
    
    Slightly different fix in each case:
    
    For platforms, we already had the latest matching version as a result of 
our call to getLatestMatchingNpmVersion(), so we just use that.
    
    For plugins, in this specific scenario (a caret version) we turn it into a 
standard range using a version of semver that understands caret ranges (so 
'^1.2.3' becomes '>=1.2.3 <2.0.0') and use that instead.
    
    Also, I noticed that we failed to find the version in config.xml if you 
added it using the new form (cordova-plugin-camera, for example), but it was 
stored in config.xml using the id, so fixed that.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to