Sharing data between hooks
Hooks can expose values to other hooks by returning a hook output object. Takomo stores the returned value with a hook's name in a mutable variables object that it then passes to the subsequent hooks. Takomo discards the mutable variables object after the stack operation completes, which means the exposed data is not visible to hooks executed in other stacks.
Example
This example shows how you can share data between hooks.
Our file structure looks like this:
There are two custom hooks located in the hooks dir.
The first hook returns a hook output object that contains a greeting to other hooks in the value
property.
The second hook reads the greeting from the input argument.
And this is how you glue everything together in a stack configuration file:
The hooks
property defines two hooks, one of each type. Takomo executes the hooks in order they are defined.
Last updated