I just cloned repository of the cordova app, but in .gitignore file added dir /plugins.
How can i install these missing plugins? U tried to find any config file where used plugins are saved, but without luck.
Many thanks for any advice.
If you added the add_plugin & remove plugin hooks, your package.json shall have a cordovaPlugins list.
If yes, then, the solution that i used is to remove the platform and add it again to fetch for all plugins
cordova platform remove android
cordova platform add android
here are the needed hooks
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));
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));
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);
});
});
One other solution is to add a task for plugin installation as described on this page : http://jbavari.github.io/blog/2014/06/24/managing-cordova-plugins-with-package-dot-json-and-hooks/