Tasks
Tasks are what define which skill should be used when a specific subcommand is called. For example, when alfred run build
is called, Alfred needs to decide which skill to run build
with (either @alfred/skill-rollup
, @alfred/skill-parcel
, or @alfred/skill-webpack
).
Skill with Tasks
This is an example of a skill for parcel which supports both the build
and start
subcommands:
Skill with Tasks and Configs
Skills can support different platforms and projects. When adding a task to a skill, the task config takes an optional supports
property, which is an object containing the projectss, platforms, and environments the skill supports for th given task.
If supports
is not passed, Alfred will assume the task supports all platforms, projects, and environments.
Running once for each target
Certain tasks need to be run once for each target. One example of this is the @alfred/task-build
task, which need to build each target it supports. The @alfred/task-lint
task only needs to be run once for all targets.
Running once for each target
Running once for all targets
Resolving a Skill
resolveSkill
takes an array of Skills and returns the skill to be resolved. If runForEachTarget
is true, a target paramater is passed to resolveSkill
.