I know that node_modules and platforms does not need to be inside git but I think that the plugins folder should be.
Am I wrong? There is a way to work with cordova plugins like we work with node modules? Putting them in a package folder and specify the version so everyone can install it the same version?
Just curious and being a bit lazy to test this out … if I were working on an existing Ionic-based project on Github, and the plugins directory wasn’t checked in, how would I know what plugins to add without asking the people that have added plugins?
You could either keep the plugins in the repo, or use a cordova hook to add them.
#!/usr/bin/env node
//this hook installs all your plugins
// add your plugins to this list--either
// the identifier, the filesystem location
// or the URL
var pluginlist = [
"org.apache.cordova.device",
"org.apache.cordova.device-motion",
"org.apache.cordova.device-orientation",
"org.apache.cordova.geolocation",
"https://github.com/chrisekelley/AppPreferences/"
];
// no need to configure below
var fs = require('fs');
var path = require('path');
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) {
sys.puts(stdout)
}
pluginlist.forEach(function(plug) {
exec("cordova plugin add " + plug, puts);
});
You would just edit the hook to include the plugins you need. Also, hooks can be executed during multiple points in the cordova process.