Search code examples
cordovacordova-plugins

Minimal cordova version for plugin


Is there a way to figure out minimal required version of Cordova for a plugin by looking at the repository for the plugin?

I'm looking at https://github.com/apache/cordova-plugin-file and I would expect that minimally required version of cordova would be specified somewhere.


Solution

  • You can get to know it if it is defined in plugin's package.json Unfortunately in case of file plugin, it is not defined. In this case, the behavior of plugin installation is follows as defined in cordova official documentation,

    Cordova 6.1.0 added support for specifying the Cordova-related dependencies of a plugin as part of the plugin's package.json file. Plugins may list the dependencies for multiple releases so as to provide guidance to the Cordova CLI when it is selecting the version of a plugin to fetch from npm. The CLI will choose the latest release of a plugin that is compatible with the local project's installed platforms and plugins as well as the the local Cordova CLI version. If no releases of the plugin are compatible, the CLI will warn the user about the failed requirements and fall back to the old behavior of fetching the latest release.
    
    This feature is intended to eventually replace the engines element in plugin.xml. Listing dependencies is a good way to ensure that your plugin will not appear broken or cause build errors when fetched from npm. If the latest release of the plugin is not compatible with a project, the CLI will give the app developer a list of unmet project requirements so that they are aware of incompatibilites and can update their project to support your plugin. This allows your plugin to respond to breaking changes without fear of confusing devlopers who are building against old platforms and plugins.
    

    Check out this link for more info. Have a look at file opener plugin's package.json which defines minimal required cordova version. Hope it helps.