I like the idea of hooks as events. Re: publishing to npm, I like to idea of hook publishing, but do we need another "package type"? Platforms, plugins, and now hooks would all have different process/documentation. Why not just add hooks support for plugins (I commented as such on the other thread first).
-Michal On Tue, Aug 5, 2014 at 4:31 PM, Brian LeRoux <b...@brian.io> wrote: > yes! this > > and related to your earlier thread: maybe hooks themselves should just be > npm modules > > The hook lookups could walk up node_modules and look for modules with a > package.json that have a "cordova" key… maybe this should go to the other > thread > > > On Tue, Aug 5, 2014 at 1:18 PM, Carlos Santana <csantan...@gmail.com> > wrote: > > > I started to write hooks, and I got lazy :-) > > > > What about having a single hook nodejs script that listen on cordova > > events? > > > > My script will look something like this: > > > > function worklightBeforePrepare(){ > > console.log('Running Worklight worklightBeforePrepare()'); > > } > > function worklightAfterCompile(){ > > console.log('Running Worklight worklightAfterCompile()'); > > } > > function worklightHooks(cordova_lib){ > > cordova_lib.events.on('before_prepare',worklightBeforePrepare); > > cordova_lib.events.on('after_compile',worklightAfterCompile); > > } > > module.exports = { > > run: worklightHooks > > } > > > > > > Then when cordova cli starts it always runs my hook script: > > > > var script = path.join(root,'hook/global/worklight_cordova_hook.js'); > > var hook = require(script); > > hook.run(cordova_lib); > > > > > > -- > > Carlos Santana > > <csantan...@gmail.com> > > >