2023-08-08 21:54:49 -07:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
import task from 'tasuku'
|
|
|
|
|
|
|
|
task('Task 1', async ({ setTitle }) => {
|
|
|
|
console.log('hey')
|
|
|
|
setTitle('Task 1 finished')
|
|
|
|
})
|
|
|
|
|
|
|
|
task('Task 2', async () => {
|
|
|
|
console.log('yo')
|
|
|
|
const nestedTask = await task('Do another task', async ({ task }) => {
|
|
|
|
await someAsyncTask()
|
|
|
|
})
|
|
|
|
|
|
|
|
nestedTask.clear()
|
|
|
|
})
|
|
|
|
|
|
|
|
task('Task 3', async () => {
|
|
|
|
console.log('sup')
|
|
|
|
})
|
|
|
|
|
|
|
|
const api = await task.group(task => [
|
|
|
|
task(
|
|
|
|
'Task 1',
|
|
|
|
async () => await someAsyncTask()
|
|
|
|
),
|
|
|
|
|
|
|
|
task(
|
|
|
|
'Task 2',
|
|
|
|
async () => await someAsyncTask()
|
|
|
|
)
|
|
|
|
|
|
|
|
// ...
|
|
|
|
], {
|
|
|
|
concurrency: 2 // Number of tasks to run at a time
|
|
|
|
})
|
|
|
|
|
|
|
|
api.clear() // Clear output
|