Repository: cordova-windows Updated Branches: refs/heads/4.3.x 7ce3444b2 -> 7f9b79c58
CB-10138 Adds missing plugin metadata to plugin_list module for Windows Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/cd1d4f9d Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/cd1d4f9d Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/cd1d4f9d Branch: refs/heads/4.3.x Commit: cd1d4f9d412937b8ecdf0701f23a6fc92d3e4277 Parents: 7ce3444 Author: Ryan Fiorini (Intel) <ryan.fior...@intel.com> Authored: Wed Feb 17 10:11:55 2016 -0500 Committer: Vladimir Kotikov <kotikov.vladi...@gmail.com> Committed: Tue Mar 29 15:49:43 2016 +0300 ---------------------------------------------------------------------- template/cordova/Api.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/cd1d4f9d/template/cordova/Api.js ---------------------------------------------------------------------- diff --git a/template/cordova/Api.js b/template/cordova/Api.js index 5803817..d4a9e6c 100644 --- a/template/cordova/Api.js +++ b/template/cordova/Api.js @@ -409,6 +409,11 @@ Api.prototype._addModulesInfo = function(plugin, targetDir) { }); this._platformJson.root.modules = installedModules.concat(modulesToInstall); + if (!this._platformJson.root.plugin_metadata) { + this._platformJson.root.plugin_metadata = {}; + } + this._platformJson.root.plugin_metadata[plugin.id] = plugin.version; + this._writePluginModules(targetDir); this._platformJson.save(); }; @@ -435,6 +440,10 @@ Api.prototype._removeModulesInfo = function(plugin, targetDir) { }); this._platformJson.root.modules = updatedModules; + if (this._platformJson.root.plugin_metadata) { + delete this._platformJson.root.plugin_metadata[plugin.id]; + } + this._writePluginModules(targetDir); this._platformJson.save(); }; @@ -448,20 +457,13 @@ Api.prototype._removeModulesInfo = function(plugin, targetDir) { * directories. */ Api.prototype._writePluginModules = function (targetDir) { - var self = this; // Write out moduleObjects as JSON wrapped in a cordova module to cordova_plugins.js var final_contents = 'cordova.define(\'cordova/plugin_list\', function(require, exports, module) {\n'; final_contents += 'module.exports = ' + JSON.stringify(this._platformJson.root.modules, null, ' ') + ';\n'; final_contents += 'module.exports.metadata = \n'; final_contents += '// TOP OF METADATA\n'; - var pluginMetadata = Object.keys(this._platformJson.root.installed_plugins) - .reduce(function (metadata, plugin) { - metadata[plugin] = self._platformJson.root.installed_plugins[plugin].version; - return metadata; - }, {}); - - final_contents += JSON.stringify(pluginMetadata, null, ' ') + '\n'; + final_contents += JSON.stringify(this._platformJson.root.plugin_metadata, null, 4) + ';\n'; final_contents += '// BOTTOM OF METADATA\n'; final_contents += '});'; // Close cordova.define. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org