Introduction
jko defines a set of special directives that allow developers to manage scripts, and orchestrate tasks:
$pre
– Defines pre-execution steps that must run before the script.$post
– Specifies post-execution actions that run after the script.$catch
– Handles errors within the script, allowing custom error responses.$disable
– Prevents a specific script from executing.$comment
– Adds a descriptive remark for a specific script.
Using Directives
These directives are meant to be used as keys within the scripts
object, defining the required behaviors:
export default {
scripts: {
"directive ...": "..."
}
}
jko
recognizes these structures and interprets them to execute the appropriate operations.
This implies that some directives cannot be used as script names.
The structure follows this format:
"$directiveName (scriptName)": "value"
- The $ appears first.
- Then directive name.
- It is followed by one space.
- The script name affected by the directive is enclosed in parentheses.
e.g.
"$comment (scriptName)": "value"