-
Notifications
You must be signed in to change notification settings - Fork 940
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import { EnvHandler } from "@teambit/envs"; | ||
import { Pipeline } from "./pipeline"; | ||
|
||
export interface BuilderEnv { | ||
/** | ||
* return a build pipeline instance. | ||
*/ | ||
build(): EnvHandler<Pipeline>; | ||
build(): Pipeline; | ||
/** | ||
* return a snap pipeline instance. | ||
*/ | ||
snap(): EnvHandler<Pipeline>; | ||
snap(): Pipeline; | ||
/** | ||
* return a tag pipeline instance. | ||
*/ | ||
tag(): EnvHandler<Pipeline>; | ||
tag(): Pipeline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { BuildContext, BuiltTaskResult } from "./build-task"; | ||
import { TaskResultsList } from "./task-results-list"; | ||
|
||
/** | ||
* this is the external interface for task. please make | ||
* sure to use only this interface outside of this builder | ||
* aspect. | ||
*/ | ||
export interface Task { | ||
/** | ||
* names ideally with dashes 'typescript' | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* description of what the task does. | ||
*/ | ||
description?: string; | ||
|
||
/** | ||
* execute a task in a build context | ||
*/ | ||
execute(context: BuildContext): Promise<BuiltTaskResult>; | ||
|
||
/** | ||
* run before the build pipeline has started. this is useful when some preparation are needed to | ||
* be done on all envs before the build starts. | ||
* e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will | ||
* cause dependencies from other envs to get this tsconfig written. | ||
*/ | ||
preBuild?(context: BuildContext): Promise<void>; | ||
|
||
/** | ||
* run after the build pipeline completed for all envs. useful for doing some cleanup on the | ||
* capsules before the deployment starts. | ||
*/ | ||
postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>; | ||
|
||
/** | ||
* needed if you want the task to be running only after the dependencies were completed | ||
* for *all* envs. | ||
* normally this is not needed because the build-pipeline runs the tasks in the same order | ||
* they're located in the `getBuildPipe()` array and according to the task.location. | ||
* the case where this is useful is when a task not only needs to be after another task, but also | ||
* after all environments were running that task. | ||
* a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use | ||
* "aspectId:name", e.g. "teambit.compilation/compiler:TypescriptCompiler". | ||
*/ | ||
dependencies?: string[]; | ||
} |