NativeScript/nativescript-hook

list of available hooks

farfromrefug opened this issue · 5 comments

@rosen-vladimirov i would like to run a hook after the "pod" install for iOS app from my plugin.
Though i can't find the list of available hooks, thus i don't know if i can do it.

Do you have a list of all the available hooks anywhere?

Thanks

bump this one i really need this right now

Fatme commented

@farfromrefug,

This is the list of the supported hooks:

  • after-createProject – executed after CLI creates the project from template
  • before-watch – executed exactly before CLI starts watching the project directory
  • after-watch – executed when CLI stops watching the project directory
  • watchPatterns (before-watchPatterns and after-watchPatterns) – executed when CLI tries to determine the glob patterns for watching the project directory. The purpose here is that you can modify the patterns in case you want to tell CLI to watch additional directories
  • liveSync (before-livesync and after-livesync) – executed during the initial sync of the application.
  • before-preview-sync – executed before starting the LiveSync to Preview application, i.e. when you scan the QR code printed in the tns preview command.
  • prepare (before-prepare and after-prepare) – executed before/after the actual preparation of the project.
  • prepareJSApp (before-prepareJSApp and after-prepareJSApp) – executed before/after the actual preparation of the JS part of the project.
  • checkForChanges (before-checkForChanges and after-checkForChanges) – executed before/after CLI checks which parts of the application should be prepared.
  • shouldPrepare (before-shouldPrepare and after-shouldPrepare) – executed when before/after CLI had decided if it needs to prepare any part of the application.
  • install (before-install and after-install) – executed before/after application is installed from CLI on device/emulator/simulator.
  • cleanApp (before-cleanApp and after-cleanApp) – executed before/after CLI cleans the app directory in the platforms directory
  • buildAndroidPlugin (before-buildAndroidPlugin and after-buildAndroidPlugin) – during building the .aar of Android plugin.

Currently it is not possible to run a hook exactly after pod install command.
As the pod install is a part of the preparation of the project, maybe after-prepare is the right hook for you.

@Fatme amazing. Any chance you can put that in the repo Readme?

Which hook can I use AFTER platforms folder is created, but BEFORE gradle build is started? I have to modify the build.gradle file.

xuhcc commented

@Gamadril You can do that with after-prepare hook.