[
https://issues.apache.org/jira/browse/CB-10679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15200687#comment-15200687
]
ASF GitHub Bot commented on CB-10679:
-------------------------------------
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"
> Update plugin add behavior to allow plugins to list engine constraints
> ----------------------------------------------------------------------
>
> Key: CB-10679
> URL: https://issues.apache.org/jira/browse/CB-10679
> Project: Apache Cordova
> Issue Type: Improvement
> Components: CordovaLib
> Reporter: Richard B Knoll
> Assignee: Richard B Knoll
> Labels: triaged
>
> Let plugins specify their Cordova related dependencies in their package.json
> so that the CLI can choose a compatible version for the current project.
> Full specification is here:
> https://github.com/cordova/cordova-discuss/pull/30
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]