Repository: cordova-cli Updated Branches: refs/heads/master c73f795af -> cbc7514ab
CB-10679: Documenting how the CLI chooses plugin versions This closes #241 Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/cbc7514a Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/cbc7514a Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/cbc7514a Branch: refs/heads/master Commit: cbc7514ab663926da62cf9bbac3d821da7cc26aa Parents: c73f795 Author: Richard Knoll <richard.b.kn...@gmail.com> Authored: Thu Mar 10 10:32:14 2016 -0800 Committer: Richard Knoll <richard.b.kn...@gmail.com> Committed: Mon Mar 21 16:25:24 2016 -0700 ---------------------------------------------------------------------- doc/readme.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cbc7514a/doc/readme.md ---------------------------------------------------------------------- diff --git a/doc/readme.md b/doc/readme.md index 5626ac3..53a7162 100644 --- a/doc/readme.md +++ b/doc/readme.md @@ -70,11 +70,11 @@ These options apply to all cordova-cli commands. ## Platform-specific options -Certain commands have options (`platformOpts`) that are specific to a particular platform. They can be provided to the cordova-cli with a '--' separator that stops the command parsing within the cordova-lib module and passes through rest of the options for platforms to parse. +Certain commands have options (`platformOpts`) that are specific to a particular platform. They can be provided to the cordova-cli with a '--' separator that stops the command parsing within the cordova-lib module and passes through rest of the options for platforms to parse. ## Examples - This example demonstrates how cordova-cli can be used to create a project with the `camera` plugin and run it for `android` platform. In particular, platform specific options like `--keystore` can be provided: - + # Create a cordova project cordova create myApp com.myCompany.myApp myApp cd myApp @@ -338,6 +338,16 @@ There are a number of ways to specify a plugin: | commit-ish | Commit/tag/branch reference. If none is specified, 'master' is used | subdir | Sub-directory to find plugin.xml for the specified plugin. +### Algorithm for resolving plugins + +When adding a plugin to a project, the CLI will resolve the plugin +based on the following criteria (listed in order of precedence): + +1. The `plugin-spec` given in the command (e.g. `cordova plugin add pluginID@version`) +2. The `plugin-spec` saved in `config.xml` (i.e. if the plugin was previously added with `--save`) +3. As of Cordova version 6.1, the latest plugin version published to npm that the current project can support (only applies to plugins that list their [Cordova dependencies] in their `package.json`) +4. The latest plugin version published to npm + ### Examples - Add `cordova-plugin-camera` and `cordova-plugin-file` to the project and save it to `config.xml`. Use `../plugins` directory to search for the plugins. @@ -584,3 +594,4 @@ cordova -h [command] [Hooks guide]: http://cordova.apache.org/docs/en/latest/guide_appdev_hooks_index.md.html [config.xml ref]: http://cordova.apache.org/docs/en/latest/config_ref/index.html +[Cordova dependencies]: http://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html#specifying-project-requirements --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org