[ 
https://issues.apache.org/jira/browse/CB-9147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14580733#comment-14580733
 ] 

ASF subversion and git services commented on CB-9147:
-----------------------------------------------------

Commit 024b970b26d3d8b7f9a6b2f0eab2325d7716deef in cordova-lib's branch 
refs/heads/master from [~TimBarham]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-lib.git;h=024b970 ]

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.


> Adding a platform with a caret version adds the very latest rather than the 
> latest matching version
> ---------------------------------------------------------------------------------------------------
>
>                 Key: CB-9147
>                 URL: https://issues.apache.org/jira/browse/CB-9147
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: 5.0.0
>            Reporter: Tim Barham
>            Assignee: Tim Barham
>
> If you add, say, windows 3.5.0 platform to a project with the save flag:
> {noformat}
> cordova platform add windows@3.5.0 --save
> {noformat}
> We write out {{^3.5.0}} to {{config.xml}}.
> If the platform is removed then re-added, we install {{4.0.0}} instead of the 
> expected {{3.8.2}}.
> This is because internally we are using a version of {{npm}} that doesn't 
> understand caret versions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to