Cordova Hook And Access To Build Settings
During a hook for Cordova on for example before_build/before_prepare: cordova build -> before prepare hook -> prepare -> after prepare hook -> before build hook -> b
Solution 1:
Yes it is possible exactly like mentioned in the documentation. Your hook(-function) gets passed a context
object which contains all the information you need. Example context
:
{
"hook": "before_plugin_install",
"scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js",
"cmdLine": "The\\exact\\command\\cordova\\run\\with arguments",
"opts": {
"projectRoot":"C:\\path\\to\\the\\project",
"cordova": {
"platforms": ["android"],
"plugins": ["plugin-withhooks"],
"version": "0.21.7-dev"
},
"plugin": {
"id": "plugin-withhooks",
"pluginInfo": {
...
},
"platform": "android",
"dir": "C:\\path\\to\\the\\project\\plugins\\plugin-withhooks"
}
},
"cordova": {...}
}
Especially the cmdLine
property will be of interest for you to check if a --release
flag was passed and to detect which platform was built.
Post a Comment for "Cordova Hook And Access To Build Settings"