010_install_plugins.js 749 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env node
  2. /**
  3. * Install all plugins listed in package.json
  4. * https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js
  5. */
  6. var exec = require('child_process').exec;
  7. var sys = require('sys');
  8. var packageJSON = null;
  9. try {
  10. packageJSON = require('../../package.json');
  11. } catch (ex) {
  12. console.log('\nThere was an error fetching your package.json file.');
  13. console.log('\nPlease ensure a valid package.json is in the root of this project\n');
  14. return;
  15. }
  16. packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
  17. packageJSON.cordovaPlugins.forEach(function(plugin) {
  18. exec('cordova plugin add ' + plugin, function(error, stdout) {
  19. sys.puts(stdout);
  20. });
  21. });