Skip to main content

Define Tasks

In Paral, a task is the smallest unit of work you define and run. Tasks can run commands, call scripts, or orchestrate other tasks.

Basic Syntax

Tasks are defined in a Paralfile using a simple structure:

task build {
-> npm run build
}

Explanation:

  • task build → Defines a task named build.
  • run → Specifies the command to execute when the task is called.

Multiple Commands in a Task

You can run more than one command in sequence:

task dev {
-> npm install
-> npm run dev
}

Task Dependencies

Tasks can depend on other tasks:

@depend other_task
task deploy {
-> sh scripts/deploy.sh
}
  • "depend" ensures the dependent task run before the current task.
tip
  • Use short, meaningful task names.
  • Group related tasks with a prefix (e.g., db:migrate, db:seed).
  • Keep task definitions in Paralfile at the root of your project.