There are two primary ways to handle task sequencing in Overseer:
1. Using the dependencies component
Add a dependencies component to a task. Setting sequential = true ensures the listed tasks run one after another before the main task proceeds.
2. Using the orchestrator strategy
Define a task with the orchestrator strategy. This creates a single orchestration task that manages a list of tasks (which can be strings or task objects) in the specified order. This is useful for complex workflows (e.g., Clean $\rightarrow$ Build $\rightarrow$ Serve).
Note: You can also use VS Code's .vscode/tasks.json dependsOn keyword, which Overseer will automatically translate into one of these methods.
-- Method 1: dependencies component
overseer.run_task({ name = "npm serve", autostart = false }, function(task)
if task then
task:add_component({
"dependencies",
tasks = {
"npm build",
{ cmd = "sleep 10" },
},
sequential = true,
})
task:start()
end
end)
-- Method 2: orchestrator strategy
local task = overseer.new_task({
name = "Build and serve app",
strategy = {
"orchestrator",
tasks = {
"make clean",
{
"npm build",
{ cmd = { "lessc", "styles.less", "styles.css" },
},
"npm serve",
},
},
})
task:start()