[
https://issues.apache.org/jira/browse/CB-9147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14579751#comment-14579751
]
ASF GitHub Bot commented on CB-9147:
------------------------------------
Github user stevengill commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/244#discussion_r32076090
--- Diff: cordova-lib/src/plugman/registry/registry.js ---
@@ -364,6 +364,28 @@ function fetchPlugin(plugin, client, useNpmRegistry) {
});
}
+function processPluginVersion(plugin) {
+ // If plugin includes a version that is a caret range, the ancient
version of npm we're using won't now how to
+ // handle it. So we'll use our current version of semver to turn it
into a usable range.
+
+ var parts = plugin.split('@');
+ var version = parts[1];
+
+ if (!version || version.charAt(0) !== '^') {
+ return plugin;
+ }
+
+ var validRange = semver.validRange(version, /* loose */ true);
+ if (!validRange) {
+ return plugin;
+ }
+
+ console.log('Returning processed plugin range: ' + parts[0] + '@"' +
validRange + '"');
--- End diff --
Haha it happens to me all the time too.
> 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 [email protected] --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: [email protected]
For additional commands, e-mail: [email protected]