Task Merging
Task definitions in the same linear directory path are merged together to create the final definition. This is useful for making small tweaks to tasks in certain directories.
For example, suppose the root cadence.json contains the following
configuration:
{
"root": true,
"tasks": {
"test": {
"cmd": "bun test --timeout {{timeout}}",
"depends_on": ["#test"],
"params": {
"timeout": "3000"
},
"env": {
"NODE_ENV": "test",
"PGHOST": "localhost"
}
}
}
}
And a subdirectory named app contains a cadence.json with the following
configuration:
{
"tasks": {
"test": {
"depends_on": ["build"],
"env": {
"PGHOST": "postgres",
"PORT": "8000"
}
}
}
}
When cadence run test is run from the app directory, the final task
definition will be:
{
"tasks": {
"test": {
"cmd": "bun test --timeout {{timeout}}",
"depends_on": ["build"],
"params": {
"timeout": "3000"
},
"env": {
"NODE_ENV": "test",
"PGHOST": "postgres",
"PORT": "8000"
}
}
}
}
Note that while map properties such as params
and env are merged, array properties such as
depends_on are overridden.