Github user nikhilkh commented on a diff in the pull request: https://github.com/apache/cordova-docs/pull/559#discussion_r56598656 --- Diff: www/docs/en/dev/guide/hybrid/plugins/index.md --- @@ -239,3 +239,105 @@ For example, for a plugin that supports android, iOS & Windows, the keywords in ``` For more detailed example of a package.json, review the [package.json file of cordova-plugin-device](https://github.com/apache/cordova-plugin-device/blob/master/package.json). + +### Specifying Cordova Dependencies + +**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](../../../plugin_ref/spec.html#engines-and-engine) 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. + +To specify Cordova-related dependencies for a plugin, alter the `engines` element in +`package.json` to include a `cordovaDependencies` object using the following +structure: + +```javascript +engines: { + cordovaDependencies: { + PLUGIN_VERSION: { + DEPENDENCY: SEMVER_RANGE, + DEPENDENCY: SEMVER_RANGE, + ... + }, + ... + } +} +``` + +* `PLUGIN_VERSION` specifies a version of your plugin. It should adhere the syntax for a single version as defined by [npm's semver package][npm-semver] or an upper bound (see [below](#upper-bounds)) --- End diff -- Nit: You could as well hyper-link "upper bound"
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org