cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TimBarham <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: New plugin version selection implementat...
Date Thu, 18 Feb 2016 12:10:02 GMT
Github user TimBarham commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/363#discussion_r53305710
  
    --- Diff: cordova-lib/src/cordova/plugin.js ---
    @@ -154,6 +135,38 @@ module.exports = function plugin(command, targets, opts) {
                                 is_top_level: true
                             };
     
    +                        // If no version is specified, retrieve the version (or source)
from config.xml
    +                        if (!version && !cordova_util.isUrl(id) && !cordova_util.isDirectory(id))
{
    +                            events.emit('verbose', 'no version specified, retrieving
version from config.xml');
    +                            var ver = getVersionFromConfigFile(id, cfg);
    +
    +                            if (cordova_util.isUrl(ver) || cordova_util.isDirectory(ver))
{
    +                                target = ver;
    +                            } else if (ver) {
    +                                // If version exists in config.xml, use that
    +                                target = ver ? (id + '@' + ver) : target;
    +                            } else {
    +                                // If no version is given at all, We need to decide what
version to
    +                                // fetch based on the current project
    +                                return registry.info([id])
    +                                .then(function(pluginInfo) {
    +                                    return getFetchVersion(projectRoot, pluginInfo, pkgJson.version);
    +                                })
    +                                .then(function(fetchVersion) {
    +                                    // Fallback to pinned version if available
    +                                    fetchVersion = fetchVersion ? fetchVersion : pkgJson.cordovaPlugins[id];
    --- End diff --
    
    `getFetchVersion()` could return null in two scenarios:
    * The plugin didn't specify any constraints.
    * The plugin specifies constraints and we fail to meet them.
    
    It seems we really should be able to differentiate between these two scenarios. For example:
    * Should we only fall back on pinned version if the plugin doesn't define constraints?
    * If the plugin does define constraints and we fail to meet them, should we display a
warning that we're picking a plugin version that might not work?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message