Cordoba, how to install missing plugins after a checkout project from a repo?

I just cloned the cordova application repository, but the dir / plugins file was added to the .gitignore file.

How can I install these missing plugins? U tried to find any configuration file in which used plugins were saved, but without any luck.

Thanks so much for any advice.

+5
source share
3 answers

If you added add_plugin and removed the plugins, your .json package should have a list of cordovaPlugins.

If so, then the solution I used is to remove the platform and add it again for extraction for all plugins

cordova platform remove android cordova platform add android 

here are the necessary hooks

<strong> hooks / after _plugin_add / 010_register_plugin.js

 #!/usr/bin/env node /** * Push plugins to cordovaPlugins array after_plugin_add */ var fs = require('fs'); var packageJSON = require('../../package.json'); packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) { if(packageJSON.cordovaPlugins.indexOf(plugin) == -1) { packageJSON.cordovaPlugins.push(plugin); } }); fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2)); 

<strong> hooks / after _plugin_rm / 010_deregister_plugin.js

 #!/usr/bin/env node /** * Remove plugins from cordovaPlugins array after_plugin_rm */ var fs = require('fs'); var packageJSON = require('../../package.json'); packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) { var index = packageJSON.cordovaPlugins.indexOf(plugin); if (index > -1) { packageJSON.cordovaPlugins.splice(index, 1); } }); fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2)); 

<strong> hooks / after _platform_add / 010_install_plugins.js

 #!/usr/bin/env node /** * Install all plugins listed in package.json * https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js */ var exec = require('child_process').exec; var path = require('path'); var sys = require('sys'); var packageJSON = require('../../package.json'); var cmd = process.platform === 'win32' ? 'cordova.cmd' : 'cordova'; // var script = path.resolve(__dirname, '../../node_modules/cordova/bin', cmd); packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; packageJSON.cordovaPlugins.forEach(function (plugin) { exec('cordova plugin add ' + plugin, function (error, stdout, stderr) { sys.puts(stdout); }); }); 

Another solution is to add a task to install the plugin, as described on this page: http://jbavari.imtqy.com/blog/2014/06/24/managing-cordova-plugins-with-package-dot-json-and- hooks /

0
source

You can use ionic state to manage plugins and formats.

https://github.com/driftyco/ionic-cli#ionic-state


Read the package.json file and install the listed plugins / forms:

 ionic state restore 

Save current plugins / platforms in package.json:

 ionic state save 

Remove everything! (including Ionic plugins by default ...):

 ionic state clear 

Delete everything and return what you indicated in your package. json:

 ionic state reset 
+12
source

cordova prepare seemed a trick to me. After cloning my repository, I got the error "No platforms added to this project" when running cordova requirements , although the platforms were listed in the config.xml file. Running cordova prepare populates the plugin catalogs, allowing you to run cordova requirements .

+3
source

All Articles