Skip to content

Instantly share code, notes, and snippets.

@phynet
Last active February 8, 2016 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phynet/38ceec837c9568b790e6 to your computer and use it in GitHub Desktop.
Save phynet/38ceec837c9568b790e6 to your computer and use it in GitHub Desktop.
How to install a CL in a node-JS cordova plugin? you may ask. I did the same question. Here it is.
module.exports = function(ctx) {
console.log('Installing npm packgae replace');
var Q = ctx.requireCordovaModule('q');
var deferral = new Q.defer();
var exec = require('child_process').exec;
var child = exec('npm install replace', function(error,stdout,stderr){
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
deferral.resolve();
});
return deferral.promise;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment