Run Scripts During The Build
During the Appflow build process, it might be necessary to run custom scripts and it is important to know what will and won't run.
#
Cordova HooksCordova hooks are specified in your config.xml
and when used with the Cordova CLI will execute scripts. Appflow however uses Gym to compile your Application, so Cordova hooks will not run with the exception of after_platform_add
and after_prepare
.
#
Ionic HooksIonic has a set of hooks which are specified in your package.json
to execute scripts during certain events. These hooks do not run with Appflow.
#
Npm Pre & Post ScriptsNpm will execute scripts before and after a command is run (documented here). If you create a script called prebuild
or postbuild
in your package.json
these will run before and after the build
step in Appflow.
note
The postbuild
script of package.json
will run after your web source code is compiled and not after your native code is compiled.
#
ConclusionIf you are looking to run scripts during the Appflow build process you can use npm pre & post scripts or the after_platform_add
and after_prepare
hooks for cordova projects. For additional automation options look at the Appflow Automation feature.