Last active
February 8, 2016 08:19
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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