Tuesday 15 February 2011

node.js - cordova hook: stop node until promise finished -



node.js - cordova hook: stop node until promise finished -

i'm writting cordova hook updates plugins on before_prepare.

three questions here:

i'm getting error: [typeerror: cannot read property 'buffer' of undefined] i stop flow until plugin has been updated is possible know if plugin added cordova plugin registry or git repo?

the code i'm using:

var plugin = context.requirecordovamodule('cordova-lib/src/cordova/plugin'), pluginnames = context.opts.cordova.plugins; function updateplugin(pluginnames) { pluginnames.foreach(function (pluginname) { homecoming removeplugin(pluginname).then(function () { addplugin(pluginname); }, function(e) { console.log(e); // error: [typeerror: cannot read property 'buffer' of undefined] }); }); } function removeplugin(pluginnames) { homecoming plugin('rm', pluginnames); } function addplugin(pluginnames) { homecoming plugin('add', pluginnames); } updateplugin(pluginnames);

to resolve 1 & 2, seek updating nodejs latest stable version, , using execsync execute cordova cli commands synchronously:

var execsync = require('child_process').execsync; ... execsync("cordova plugin rm " + plugin); execsync("cordova plugin add together " + plugin);

node.js cordova hook cordova-plugins

No comments:

Post a Comment