Github user TimBarham commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/363#discussion_r53301382
--- Diff: cordova-lib/src/cordova/plugin.js ---
@@ -507,3 +527,117 @@ function versionString(version) {
return null;
}
+
+/**
+ * Gets the version of a plugin that should be fetched for a given project
based
+ * on the plugin's engine information from NPM and the platforms/plugins
installed
+ * in the project
+ *
+ * @param {string} projectRoot The path to the root directory of the
project
+ * @param {object} pluginInfo The NPM info of the plugin be fetched
(e.g. the
+ * result of calling `registry.info()`)
+ * @param {string} cordovaVersion The semver version of cordova-lib
+ *
+ * @return {Promise} A promise that will resolve to either
a string
+ * if there is a version of the plugin
that this
+ * project satisfies or null if there is
not
+ */
+function getFetchVersion(projectRoot, pluginInfo, cordovaVersion) {
+ // Figure out the project requirements
+ if (pluginInfo.engines && pluginInfo.engines.cordovaDependencies) {
+ var pluginList = getInstalledPlugins(projectRoot);
+ var pluginMap = {};
+
+ for(var i = 0; i < pluginList.length; i++) {
+ pluginMap[pluginList[i].id] = pluginList[i].version;
+ }
--- End diff --
Minor nit, but this would be cleaner if you used `pluginList.forEach()` (or
even `pluginList.reduce()`).
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]