cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Grebnov (Akvelon)" <v-seg...@microsoft.com>
Subject Proposal: hooks support for plugins
Date Sat, 01 Mar 2014 18:39:18 GMT
Hi, I have an idea how we can add more flexibility to plugin developers and would like to discuss
it.

Note, right now we have Application Developers - someone who use Cordova for developing applications
and Plugin Developers - someone who creates plugins so that Application Developers can use
them. For Application Developers we expose  hooks so that they can customize their build/package/etc
process. I want us to provide similar sort of flexibility to Plugin Developers so that they
can go beyond of <source/>, <framework/>  tags and get mechanism to add custom
installation,  build logic required by a plugin. Example usage will include: downloading/compiling
additional binaries, marking source file to be copied to output dir, changing target build
platform,  etc. At present time the steps described could be only achieved by hooks manually
added by Application Developer, but the right way is to allow Plugin Developer to expose this
as part of plugin definition.

I personally like how npm-scripts[1] work so propose to introduce additional <scripts>
section in plugin.xml, for example

<scripts preinstall="preinstall.js" postinstall="afterinstall.js" />

preinstall.js is called before plugman.raw.install(platform, platformRoot, path.basename(dir),
pluginsDir, options) and could be used to check system requirements, download/compile required
libraries, etc

afterinstall.js is called after and could be used  to add/configure additional project references,
 etc
uninstall.js - for discussion, could be used for clean up, etc

As for required parameters I think we should pass at least application folder and target platform.

Thoughts? Propose to discuss this on the monthly sync, Mar 4, 2014 (7pm EST)

[1] https://www.npmjs.org/doc/misc/npm-scripts.html

-Sergey

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message