Edit in GitHubLog an issue

App Builder application tooling lifecycle event hooks

Sample hooks configuration#

For example, pre and post hooks can be defined for the run, build and deploy commands in the app.config.yaml or ext.config.yaml file of your app. For the run, build and deploy commands, you can specify build and deploy script substitutes as well. For the run command, you can specify an additional serve-static script (to custom serve your web assets).

Legacy App (no extensions)#

In the root of your app, you will have to add a hooks key in the app.config.yaml file, under the application key. Example:

Copied to your clipboard
1application:
2 hooks:
3 pre-app-run: echo pre-app-run

If you add extensions to a standalone app via aio app add extension, note that your app.config.yaml hooks will always run first, then your extension hooks in each ext.config.yaml will be run.

App with Extensions#

In your app extension folder (typically at src/EXTENSION_NAME), find the ext.config.yaml file, and add in a hooks key. Example:

Copied to your clipboard
1hooks:
2 pre-app-run: echo pre-app-run

Command Support#

aio app run supports:

Copied to your clipboard
1hooks:
2 pre-app-run: echo pre-app-run
3 post-app-run: echo post-app-run
4 pre-app-build: echo pre-app-build
5 post-app-build: echo post-app-build
6 pre-app-deploy: echo pre-app-deploy
7 post-app-deploy: echo post-app-deploy
8 build-actions: echo build-actions
9 deploy-actions: echo deploy-actions
10 build-static: echo build-static
11 serve-static: echo serve-static
12 pre-app-undeploy: echo pre-app-undeploy
13 post-app-undeploy: echo post-app-undeploy
14 undeploy-actions: echo undeploy-actions
15 undeploy-static: echo undeploy-static

aio app build supports:

Copied to your clipboard
1hooks:
2 pre-app-build: echo pre-app-build
3 post-app-build: echo post-app-build
4 build-actions: echo build-actions
5 build-static: echo build-static

aio app deploy supports:

Copied to your clipboard
1hooks:
2 pre-app-build: echo pre-app-build
3 post-app-build: echo post-app-build
4 pre-app-deploy: echo pre-app-deploy
5 post-app-deploy: echo post-app-deploy
6 build-actions: echo build-actions
7 build-static: echo build-static
8 deploy-actions: echo deploy-actions
9 deploy-static: echo deploy-static

aio app undeploy supports:

Copied to your clipboard
1hooks:
2 pre-app-undeploy: echo pre-app-undeploy
3 post-app-undeploy: echo post-app-undeploy
4 undeploy-actions: echo undeploy-actions
5 undeploy-static: echo undeploy-static

aio app test supports:

Copied to your clipboard
1hooks:
2 test: echo this is your custom test runner

Use cases#

aio app run hooks:

  • manage additional local development tooling that is not managed by the out-of-the-box flow

aio app build build-static and build-actions hooks:

  • build actions to include static files with the action zipfile (for templates like in server-side rendering)
  • build the web assets with a different bundler and configuration, for example webpack

aio app deploy deploy-static and deploy-actions hooks:

  • support additional deployment steps (e.g. deploy to multiple servers or locations)

aio app undeploy undeploy-static and undeploy-actions hooks:

  • support additional un-deployment steps (e.g. un-deploy from multiple servers or locations)

aio app test test hook:

  • support a custom test runner for your app or extension

Hooks flow#

The following diagram illustrates how your custom hooks will be executed within the application via the various commands:

aio-app-run lifecycle

aio-app-build lifecycle

aio-app-deploy lifecycle

aio-app-undeploy lifecycle

  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.