@teambit/builder 1.0.227 → 1.0.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/artifacts/__bit_junit.xml +1 -1
  2. package/artifacts/preview/teambit_pipelines_builder-preview.js +1 -1
  3. package/artifacts/schema.json +708 -182
  4. package/dist/artifact/artifact-definition.d.ts +65 -0
  5. package/dist/artifact/artifact-extractor.d.ts +35 -0
  6. package/dist/artifact/artifact-factory.d.ts +20 -0
  7. package/dist/artifact/artifact-list.d.ts +52 -0
  8. package/dist/artifact/artifact.d.ts +59 -0
  9. package/dist/artifact/artifacts.cmd.d.ts +26 -0
  10. package/dist/artifact/extension-artifact.d.ts +10 -0
  11. package/dist/artifact/fs-artifact.d.ts +18 -0
  12. package/dist/artifact/index.d.ts +6 -0
  13. package/dist/build-pipe.d.ts +75 -0
  14. package/dist/build-pipe.js +0 -13
  15. package/dist/build-pipe.js.map +1 -1
  16. package/dist/build-pipeline-order.d.ts +35 -0
  17. package/dist/build-pipeline-result-list.d.ts +34 -0
  18. package/dist/build-task.d.ts +128 -0
  19. package/dist/build.cmd.d.ts +39 -0
  20. package/dist/builder-env-type.d.ts +15 -0
  21. package/dist/builder.aspect.d.ts +2 -0
  22. package/dist/builder.composition.d.ts +1 -0
  23. package/dist/builder.graphql.d.ts +102 -0
  24. package/dist/builder.main.runtime.d.ts +153 -0
  25. package/dist/builder.route.d.ts +20 -0
  26. package/dist/builder.service.d.ts +105 -0
  27. package/dist/exceptions/artifact-definition-no-glob.d.ts +3 -0
  28. package/dist/exceptions/artifact-storage-error.d.ts +7 -0
  29. package/dist/exceptions/capsule-not-found.d.ts +5 -0
  30. package/dist/exceptions/index.d.ts +3 -0
  31. package/dist/exceptions/invalid-task.d.ts +5 -0
  32. package/dist/index.d.ts +19 -0
  33. package/dist/pipeline/index.d.ts +1 -0
  34. package/dist/pipeline/pipeline-results.d.ts +2 -0
  35. package/dist/pipeline.d.ts +43 -0
  36. package/dist/{preview-1712719054377.js → preview-1712822929999.js} +2 -2
  37. package/dist/storage/default-resolver.d.ts +7 -0
  38. package/dist/storage/index.d.ts +2 -0
  39. package/dist/storage/s3-resolver.d.ts +0 -0
  40. package/dist/storage/storage-resolver.d.ts +26 -0
  41. package/dist/task-results-list.d.ts +22 -0
  42. package/dist/task.d.ts +44 -0
  43. package/dist/tasks-queue.d.ts +16 -0
  44. package/dist/templates/build-task/files/index-file.d.ts +2 -0
  45. package/dist/templates/build-task/files/task-file.d.ts +2 -0
  46. package/dist/templates/build-task/index.d.ts +2 -0
  47. package/dist/types.d.ts +32 -0
  48. package/package.json +18 -18
  49. package/tsconfig.json +1 -49
@@ -0,0 +1,128 @@
1
+ import type { Component } from '@teambit/component';
2
+ import { LaneId } from '@teambit/lane-id';
3
+ import { ExecutionContext } from '@teambit/envs';
4
+ import type { Network } from '@teambit/isolator';
5
+ import type { ComponentResult } from './types';
6
+ import type { ArtifactDefinition } from './artifact';
7
+ import { TaskResultsList } from './task-results-list';
8
+ import { TaskResults } from './build-pipe';
9
+ import { PipeName } from './builder.service';
10
+ export type TaskLocation = 'start' | 'end';
11
+ /**
12
+ * delimiter between task.aspectId and task.name
13
+ */
14
+ export declare const TaskIdDelimiter = ":";
15
+ /**
16
+ * A folder to write artifacts generated during a build task
17
+ * This folder is used in the core envs and excluded by default from the package tar file (the core envs is writing this into the npmignore file)
18
+ */
19
+ export declare const CAPSULE_ARTIFACTS_DIR = "artifacts";
20
+ export interface BuildContext extends ExecutionContext {
21
+ /**
22
+ * all components about to be built/tagged.
23
+ */
24
+ components: Component[];
25
+ /**
26
+ * network of capsules ready to be built.
27
+ */
28
+ capsuleNetwork: Network;
29
+ /**
30
+ * data generated by tasks that were running before this task
31
+ */
32
+ previousTasksResults: TaskResults[];
33
+ /**
34
+ * Run the build pipeline in dev mode
35
+ */
36
+ dev?: boolean;
37
+ /**
38
+ * pipe name such as "build", "tas", "snap".
39
+ * an example usage is "deploy" task which is running in snap and tag pipeline and has different needs in each one.
40
+ */
41
+ pipeName: PipeName;
42
+ /**
43
+ * current lane-id if exists. empty when on main.
44
+ */
45
+ laneId?: LaneId;
46
+ }
47
+ export interface TaskDescriptor {
48
+ aspectId: string;
49
+ name?: string;
50
+ description?: string;
51
+ }
52
+ export interface BuildTask {
53
+ /**
54
+ * aspect id serialized of the creator of the task.
55
+ * todo: automate this so then it won't be needed to pass manually.
56
+ */
57
+ aspectId: string;
58
+ /**
59
+ * name of the task. function as an identifier among other tasks of the same aspectId.
60
+ * spaces and special characters are not allowed. as a convention, use UpperCamelCase style.
61
+ * (e.g. TypescriptCompiler).
62
+ */
63
+ name: string;
64
+ /**
65
+ * description of what the task does.
66
+ * if available, the logger will log it show it in the status-line.
67
+ */
68
+ description?: string;
69
+ /**
70
+ * where to put the task, before the env pipeline or after
71
+ */
72
+ location?: TaskLocation;
73
+ /**
74
+ * execute a task in a build context
75
+ */
76
+ execute(context: BuildContext): Promise<BuiltTaskResult>;
77
+ /**
78
+ * run before the build pipeline has started. this is useful when some preparation are needed to
79
+ * be done on all envs before the build starts.
80
+ * e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will
81
+ * cause dependencies from other envs to get this tsconfig written.
82
+ */
83
+ preBuild?(context: BuildContext): Promise<void>;
84
+ /**
85
+ * run after the build pipeline completed for all envs. useful for doing some cleanup on the
86
+ * capsules before the deployment starts.
87
+ */
88
+ postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;
89
+ /**
90
+ * needed if you want the task to be running only after the dependencies were completed
91
+ * for *all* envs.
92
+ * normally this is not needed because the build-pipeline runs the tasks in the same order
93
+ * they're located in the `getBuildPipe()` array and according to the task.location.
94
+ * the case where this is useful is when a task not only needs to be after another task, but also
95
+ * after all environments were running that task.
96
+ * a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use
97
+ * "aspectId:name", e.g. "teambit.compilation/compiler:TypescriptCompiler".
98
+ */
99
+ dependencies?: string[];
100
+ }
101
+ export interface BuiltTaskResult {
102
+ /**
103
+ * build results for each of the components in the build context.
104
+ */
105
+ componentsResults: ComponentResult[];
106
+ /**
107
+ * array of artifact definitions to generate after a successful build.
108
+ */
109
+ artifacts?: ArtifactDefinition[];
110
+ }
111
+ export declare class BuildTaskHelper {
112
+ static serializeId({ aspectId, name }: {
113
+ aspectId: string;
114
+ name: string;
115
+ }): string;
116
+ static deserializeId(id: string): {
117
+ aspectId: string;
118
+ name: string;
119
+ };
120
+ /**
121
+ * don't throw an error when the id includes only the aspect-id without the task name.
122
+ * useful for task dependencies, when it's allowed to specify the aspect-id only.
123
+ */
124
+ static deserializeIdAllowEmptyName(id: string): {
125
+ aspectId: string;
126
+ name?: string;
127
+ };
128
+ }
@@ -0,0 +1,39 @@
1
+ import { Command, CommandOptions } from '@teambit/cli';
2
+ import { Logger } from '@teambit/logger';
3
+ import { Workspace } from '@teambit/workspace';
4
+ import { BuilderMain } from './builder.main.runtime';
5
+ type BuildOpts = {
6
+ all: boolean;
7
+ unmodified?: boolean;
8
+ dev: boolean;
9
+ rebuild: boolean;
10
+ install: boolean;
11
+ cachePackagesOnCapsulesRoot: boolean;
12
+ reuseCapsules: boolean;
13
+ tasks: string;
14
+ listTasks?: string;
15
+ skipTests?: boolean;
16
+ failFast?: boolean;
17
+ includeSnap?: boolean;
18
+ includeTag?: boolean;
19
+ };
20
+ export declare class BuilderCmd implements Command {
21
+ private builder;
22
+ private workspace;
23
+ private logger;
24
+ name: string;
25
+ description: string;
26
+ extendedDescription: string;
27
+ arguments: {
28
+ name: string;
29
+ description: string;
30
+ }[];
31
+ helpUrl: string;
32
+ alias: string;
33
+ group: string;
34
+ options: CommandOptions;
35
+ constructor(builder: BuilderMain, workspace: Workspace, logger: Logger);
36
+ report([pattern]: [string], { all, unmodified, dev, install, cachePackagesOnCapsulesRoot, reuseCapsules, tasks, listTasks, skipTests, failFast, includeSnap, includeTag, }: BuildOpts): Promise<string>;
37
+ private getListTasks;
38
+ }
39
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Pipeline } from './pipeline';
2
+ export interface BuilderEnv {
3
+ /**
4
+ * return a build pipeline instance.
5
+ */
6
+ build(): Pipeline;
7
+ /**
8
+ * return a snap pipeline instance.
9
+ */
10
+ snap(): Pipeline;
11
+ /**
12
+ * return a tag pipeline instance.
13
+ */
14
+ tag(): Pipeline;
15
+ }
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const BuilderAspect: Aspect;
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,102 @@
1
+ import { Component, ComponentID } from '@teambit/component';
2
+ import { Logger } from '@teambit/logger';
3
+ import { BuilderMain } from './builder.main.runtime';
4
+ import { PipelineReport } from './build-pipeline-result-list';
5
+ type ArtifactGQLFile = {
6
+ /**
7
+ * same as the path - used for GQL caching
8
+ */
9
+ id: string;
10
+ /**
11
+ * name of the artifact file
12
+ */
13
+ name: string;
14
+ /**
15
+ * path of the artifact file
16
+ */
17
+ path: string;
18
+ /**
19
+ * artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data
20
+ */
21
+ content?: string;
22
+ /**
23
+ * REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat
24
+ */
25
+ downloadUrl?: string;
26
+ /**
27
+ * Remote storage url to resolve artifact file from
28
+ */
29
+ externalUrl?: string;
30
+ /**
31
+ * Size in bytes
32
+ */
33
+ size: number;
34
+ };
35
+ type ArtifactGQLData = {
36
+ name: string;
37
+ description?: string;
38
+ storage?: string;
39
+ generatedBy: string;
40
+ files: ArtifactGQLFile[];
41
+ };
42
+ type TaskReport = PipelineReport & {
43
+ artifact?: ArtifactGQLData;
44
+ componentId: ComponentID;
45
+ };
46
+ export declare function builderSchema(builder: BuilderMain, logger: Logger): {
47
+ typeDefs: import("graphql").DocumentNode;
48
+ resolvers: {
49
+ Component: {
50
+ pipelineReport: (component: Component, { taskId }: {
51
+ taskId?: string;
52
+ }) => Promise<{
53
+ id: string;
54
+ artifact: {
55
+ id: string;
56
+ name: string;
57
+ description: string | undefined;
58
+ task: import("./build-task").TaskDescriptor;
59
+ storage: string;
60
+ generatedBy: string;
61
+ files: {
62
+ id: string;
63
+ name: string;
64
+ path: string;
65
+ content: string | undefined;
66
+ downloadUrl: string;
67
+ externalUrl: string | undefined;
68
+ size: number;
69
+ }[];
70
+ } | undefined;
71
+ taskId: string;
72
+ taskName: string;
73
+ taskDescription?: string | undefined;
74
+ startTime?: number | undefined;
75
+ endTime?: number | undefined; /**
76
+ * artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data
77
+ */
78
+ errors?: (string | Error)[] | undefined;
79
+ warnings?: string[] | undefined;
80
+ }[]>;
81
+ };
82
+ TaskReport: {
83
+ id: (taskReport: TaskReport & {
84
+ id?: string;
85
+ }) => string;
86
+ description: (taskReport: TaskReport) => string | undefined;
87
+ errors: (taskReport: TaskReport) => string[];
88
+ warnings: (taskReport: TaskReport) => string[];
89
+ artifact: (taskReport: TaskReport, { path: pathFilter }: {
90
+ path?: string;
91
+ }) => Promise<{
92
+ files: ArtifactGQLFile[];
93
+ name: string;
94
+ description?: string | undefined;
95
+ storage?: string | undefined;
96
+ generatedBy: string;
97
+ id: string;
98
+ } | undefined>;
99
+ };
100
+ };
101
+ };
102
+ export {};
@@ -0,0 +1,153 @@
1
+ import { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';
2
+ import { ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';
3
+ import { AspectLoaderMain } from '@teambit/aspect-loader';
4
+ import { CLIMain } from '@teambit/cli';
5
+ import { Component, ComponentMap, IComponent, ComponentMain, ComponentID } from '@teambit/component';
6
+ import { EnvsMain } from '@teambit/envs';
7
+ import { GraphqlMain } from '@teambit/graphql';
8
+ import { SlotRegistry } from '@teambit/harmony';
9
+ import { GlobalConfigMain } from '@teambit/global-config';
10
+ import { Logger, LoggerMain } from '@teambit/logger';
11
+ import { ScopeMain } from '@teambit/scope';
12
+ import { Workspace } from '@teambit/workspace';
13
+ import { IsolateComponentsOptions, IsolatorMain } from '@teambit/isolator';
14
+ import { GeneratorMain } from '@teambit/generator';
15
+ import { UiMain } from '@teambit/ui';
16
+ import { Artifact, ArtifactList } from './artifact';
17
+ import { BuilderService, BuilderServiceOptions } from './builder.service';
18
+ import { BuildTask } from './build-task';
19
+ import { TaskResults } from './build-pipe';
20
+ import { TaskResultsList } from './task-results-list';
21
+ import { AspectData, PipelineReport } from './build-pipeline-result-list';
22
+ import { TaskMetadata } from './types';
23
+ export type TaskSlot = SlotRegistry<BuildTask[]>;
24
+ export type OnTagResults = {
25
+ builderDataMap: ComponentMap<RawBuilderData>;
26
+ pipeResults: TaskResultsList[];
27
+ };
28
+ export type OnTagOpts = {
29
+ disableTagAndSnapPipelines?: boolean;
30
+ throwOnError?: boolean;
31
+ forceDeploy?: boolean;
32
+ populateArtifactsFrom?: ComponentID[];
33
+ isSnap?: boolean;
34
+ };
35
+ export declare const FILE_PATH_PARAM_DELIM = "~";
36
+ /**
37
+ * builder data format for the bit object store
38
+ */
39
+ export type RawBuilderData = {
40
+ pipeline: PipelineReport[];
41
+ artifacts?: ArtifactObject[];
42
+ aspectsData: AspectData[];
43
+ bitVersion?: string;
44
+ };
45
+ /**
46
+ * builder data mapped to an ArtifactList instance
47
+ */
48
+ export type BuilderData = Omit<RawBuilderData, 'artifacts'> & {
49
+ artifacts: ArtifactList<Artifact>;
50
+ };
51
+ export declare class BuilderMain {
52
+ private envs;
53
+ private workspace;
54
+ private buildService;
55
+ private tagService;
56
+ private snapService;
57
+ private scope;
58
+ private isolator;
59
+ private aspectLoader;
60
+ private componentAspect;
61
+ private globalConfig;
62
+ private buildTaskSlot;
63
+ private tagTaskSlot;
64
+ private snapTaskSlot;
65
+ private logger;
66
+ constructor(envs: EnvsMain, workspace: Workspace, buildService: BuilderService, tagService: BuilderService, snapService: BuilderService, scope: ScopeMain, isolator: IsolatorMain, aspectLoader: AspectLoaderMain, componentAspect: ComponentMain, globalConfig: GlobalConfigMain, buildTaskSlot: TaskSlot, tagTaskSlot: TaskSlot, snapTaskSlot: TaskSlot, logger: Logger);
67
+ private storeArtifacts;
68
+ pipelineResultsToBuilderData(components: Component[], buildPipelineResults: TaskResults[]): ComponentMap<RawBuilderData>;
69
+ tagListener(components: Component[], options?: OnTagOpts, isolateOptions?: IsolateComponentsOptions, builderOptions?: BuilderServiceOptions): Promise<OnTagResults>;
70
+ /**
71
+ * remove the onlyOverview from the preview data of the component if
72
+ * the env is in the workspace
73
+ * the env is not tagged with the component
74
+ * the last tagged env has onlyOverview undefined in preview data
75
+ *
76
+ * We don't want to do this but have no choice because,
77
+ * when we load components in workspace,
78
+ * we set the onlyOverview to true in the env's preview data
79
+ * which sets the onlyOverview to true in the component's preview data
80
+ * but if you don't tag the env with the component,
81
+ * the onlyOverview will be true in the component's preview data, since its env is in the workspace
82
+ * even though the env it is tagged with doesn't have onlyOverview in its preview data
83
+ * which will result in inconsistent preview data when exported to the scope
84
+ */
85
+ sanitizePreviewData(harmonyComps: Component[]): Promise<void>;
86
+ private validateBuilderDataMap;
87
+ private combineBuildDataFrom;
88
+ getArtifactsVinylByAspect(component: Component, aspectName: string): Promise<ArtifactVinyl[]>;
89
+ getArtifactsVinylByAspectAndName(component: Component, aspectName: string, name: string): Promise<ArtifactVinyl[]>;
90
+ getArtifactsVinylByAspectAndTaskName(component: Component, aspectName: string, name: string): Promise<ArtifactVinyl[]>;
91
+ getArtifactsByName(component: Component, name: string): ArtifactList<Artifact>;
92
+ getArtifactsByAspect(component: Component, aspectName: string): ArtifactList<Artifact>;
93
+ getArtifactsByAspectAndName(component: Component, aspectName: string, name: string): ArtifactList<Artifact>;
94
+ getArtifactsbyAspectAndTaskName(component: IComponent, aspectName: string, taskName: string): ArtifactList<Artifact>;
95
+ /**
96
+ * this is the aspect's data that was generated as "metadata" of the task component-result during the build process
97
+ * and saved by the builder aspect in the "aspectsData" property.
98
+ * (not to be confused with the data saved in the aspect itself, which is saved in the "data" property of the aspect).
99
+ */
100
+ getDataByAspect(component: IComponent, aspectName: string): TaskMetadata | undefined;
101
+ getArtifacts(component: IComponent): ArtifactList<Artifact>;
102
+ getBuilderData(component: IComponent): BuilderData | undefined;
103
+ build(components: Component[], isolateOptions?: IsolateComponentsOptions, builderOptions?: BuilderServiceOptions, extraOptions?: {
104
+ includeTag?: boolean;
105
+ includeSnap?: boolean;
106
+ }): Promise<TaskResultsList>;
107
+ runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList>;
108
+ runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList>;
109
+ listTasks(component: Component): {
110
+ id: ComponentID;
111
+ envId: string;
112
+ buildTasks: string[];
113
+ tagTasks: string[];
114
+ snapTasks: string[];
115
+ };
116
+ /**
117
+ * register a build task to apply on all component build pipelines.
118
+ * build happens on `bit build` and as part of `bit tag --persist`.
119
+ */
120
+ registerBuildTasks(tasks: BuildTask[]): this;
121
+ /**
122
+ * @deprecated use registerTagTasks or registerSnapTasks
123
+ */
124
+ registerDeployTasks(tasks: BuildTask[]): this;
125
+ /**
126
+ * tag tasks that don't get executed on `bit build`, only on `bit tag'.
127
+ * this pipeline is running once the build-pipeline has completed.
128
+ */
129
+ registerTagTasks(tasks: BuildTask[]): this;
130
+ /**
131
+ * tag tasks that don't get executed on `bit build`, only on `bit snap'.
132
+ * this pipeline is running once the build-pipeline has completed.
133
+ */
134
+ registerSnapTasks(tasks: BuildTask[]): this;
135
+ getDownloadUrlForArtifact(componentId: ComponentID, taskId: string, path?: string): string;
136
+ static slots: ((registerFn: () => string) => SlotRegistry<BuildTask>)[];
137
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
138
+ static dependencies: import("@teambit/harmony").Aspect[];
139
+ static provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig]: [
140
+ CLIMain,
141
+ EnvsMain,
142
+ Workspace,
143
+ ScopeMain,
144
+ IsolatorMain,
145
+ LoggerMain,
146
+ AspectLoaderMain,
147
+ GraphqlMain,
148
+ GeneratorMain,
149
+ ComponentMain,
150
+ UiMain,
151
+ GlobalConfigMain
152
+ ], config: any, [buildTaskSlot, tagTaskSlot, snapTaskSlot]: [TaskSlot, TaskSlot, TaskSlot]): Promise<BuilderMain>;
153
+ }
@@ -0,0 +1,20 @@
1
+ /// <reference types="express" />
2
+ import { Request, Response, Route } from '@teambit/express';
3
+ import { Logger } from '@teambit/logger';
4
+ import { ScopeMain } from '@teambit/scope';
5
+ import { BuilderMain } from './builder.main.runtime';
6
+ export declare const routePath = "builder";
7
+ export type BuilderUrlParams = {
8
+ aspectId?: string;
9
+ filePath?: string;
10
+ };
11
+ export declare const defaultExtension = ".tgz";
12
+ export declare class BuilderRoute implements Route {
13
+ private builder;
14
+ private scope;
15
+ private logger;
16
+ constructor(builder: BuilderMain, scope: ScopeMain, logger: Logger);
17
+ route: string;
18
+ method: string;
19
+ middlewares: ((req: Request<BuilderUrlParams>, res: Response) => Promise<import("express").Response<any, Record<string, any>>>)[];
20
+ }
@@ -0,0 +1,105 @@
1
+ import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
2
+ import { ScopeMain } from '@teambit/scope';
3
+ import { GlobalConfigMain } from '@teambit/global-config';
4
+ import { Logger } from '@teambit/logger';
5
+ import { IsolatorMain } from '@teambit/isolator';
6
+ import { Component, ComponentID } from '@teambit/component';
7
+ import { TaskResults } from './build-pipe';
8
+ import { TaskResultsList } from './task-results-list';
9
+ import { TaskSlot } from './builder.main.runtime';
10
+ import { BuildContext, BuildTask } from './build-task';
11
+ import { ArtifactFactory } from './artifact';
12
+ export type BuildServiceResults = {
13
+ id: string;
14
+ buildResults: TaskResultsList;
15
+ components: Component[];
16
+ errors?: [];
17
+ };
18
+ export type BuilderServiceOptions = {
19
+ seedersOnly?: boolean;
20
+ originalSeeders?: ComponentID[];
21
+ tasks?: string[];
22
+ skipTests?: boolean;
23
+ skipTasks?: string[];
24
+ previousTasksResults?: TaskResults[];
25
+ dev?: boolean;
26
+ exitOnFirstFailedTask?: boolean;
27
+ capsulesBaseDir?: string;
28
+ };
29
+ type BuilderTransformationMap = ServiceTransformationMap & {
30
+ getBuildPipe: () => BuildTask[];
31
+ getTagPipe: () => BuildTask[];
32
+ getSnapPipe: () => BuildTask[];
33
+ };
34
+ export type EnvsBuildContext = {
35
+ [envId: string]: BuildContext;
36
+ };
37
+ declare const pipeNames: {
38
+ getBuildPipe: string;
39
+ getTagPipe: string;
40
+ getSnapPipe: string;
41
+ };
42
+ export type PipeName = 'build' | 'tag' | 'snap';
43
+ export type BuilderDescriptor = Array<{
44
+ pipeName: PipeName;
45
+ tasks: string[];
46
+ }>;
47
+ export type PipeFunctionNames = keyof typeof pipeNames;
48
+ export declare class BuilderService implements EnvService<BuildServiceResults, string> {
49
+ /**
50
+ * isolator extension.
51
+ */
52
+ private isolator;
53
+ /**
54
+ * logger extension.
55
+ */
56
+ private logger;
57
+ /**
58
+ * task slot (e.g tasks registered by other extensions.).
59
+ */
60
+ private taskSlot;
61
+ /**
62
+ * a method with such name should be implemented on the env in order to run the pipe tasks.
63
+ */
64
+ private pipeNameOnEnv;
65
+ /**
66
+ * pipe name to display on the console during the execution
67
+ */
68
+ private displayPipeName;
69
+ private artifactFactory;
70
+ private scope;
71
+ private globalConfig;
72
+ name: string;
73
+ constructor(
74
+ /**
75
+ * isolator extension.
76
+ */
77
+ isolator: IsolatorMain,
78
+ /**
79
+ * logger extension.
80
+ */
81
+ logger: Logger,
82
+ /**
83
+ * task slot (e.g tasks registered by other extensions.).
84
+ */
85
+ taskSlot: TaskSlot,
86
+ /**
87
+ * a method with such name should be implemented on the env in order to run the pipe tasks.
88
+ */
89
+ pipeNameOnEnv: PipeFunctionNames,
90
+ /**
91
+ * pipe name to display on the console during the execution
92
+ */
93
+ displayPipeName: PipeName, artifactFactory: ArtifactFactory, scope: ScopeMain, globalConfig: GlobalConfigMain);
94
+ /**
95
+ * runs all tasks for all envs
96
+ */
97
+ runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList>;
98
+ getComponentsCapsulesBaseDir(): string | undefined;
99
+ render(): string;
100
+ transform(env: Env, envContext: EnvContext): BuilderTransformationMap | undefined;
101
+ getDescriptor(): string;
102
+ private getTasksNamesByPipeFunc;
103
+ getCurrentPipeTasks(env: EnvDefinition): string[];
104
+ }
105
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare class ArtifactDefinitionError extends Error {
2
+ constructor();
3
+ }
@@ -0,0 +1,7 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ import { Component } from '@teambit/component';
3
+ export declare class ArtifactStorageError extends BitError {
4
+ private originalError;
5
+ private component;
6
+ constructor(originalError: Error, component: Component);
7
+ }
@@ -0,0 +1,5 @@
1
+ import { ComponentID } from '@teambit/component';
2
+ export declare class CapsuleNotFound extends Error {
3
+ private id;
4
+ constructor(id: ComponentID);
5
+ }
@@ -0,0 +1,3 @@
1
+ export { InvalidTask } from './invalid-task';
2
+ export { CapsuleNotFound } from './capsule-not-found';
3
+ export { ArtifactStorageError } from './artifact-storage-error';
@@ -0,0 +1,5 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ export declare class InvalidTask extends BitError {
3
+ readonly taskAspectId: string;
4
+ constructor(taskAspectId: string, reason: string);
5
+ }
@@ -0,0 +1,19 @@
1
+ import { BuilderAspect } from './builder.aspect';
2
+ export { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';
3
+ export { BuildPipe } from './build-pipe';
4
+ export type { TaskResults } from './build-pipe';
5
+ export type { ComponentResult, TaskMetadata } from './types';
6
+ export type { BuildContext, BuildTask, BuiltTaskResult, TaskLocation } from './build-task';
7
+ export { CAPSULE_ARTIFACTS_DIR } from './build-task';
8
+ export type { PipeName } from './builder.service';
9
+ export type { BuilderMain, RawBuilderData, BuilderData, OnTagOpts } from './builder.main.runtime';
10
+ export type { TaskHandler } from './pipeline';
11
+ export { Pipeline } from './pipeline';
12
+ export type { PipelineReport } from './build-pipeline-result-list';
13
+ export type { BuilderEnv } from './builder-env-type';
14
+ export type { WholeArtifactStorageResolver, FileStorageResolver, ArtifactStorageResolver } from './storage';
15
+ export type { ArtifactDefinition, ArtifactModelDefinition } from './artifact';
16
+ export { Artifact, ArtifactList, ArtifactFactory } from './artifact';
17
+ export type { Task } from './task';
18
+ export { TaskResultsList } from './task-results-list';
19
+ export { BuilderAspect, BuilderAspect as default };
@@ -0,0 +1 @@
1
+ export { PipelineResults } from './pipeline-results';
@@ -0,0 +1,2 @@
1
+ export declare class PipelineResults {
2
+ }
@@ -0,0 +1,43 @@
1
+ import { EnvContext, EnvHandler } from '@teambit/envs';
2
+ import { Task } from './task';
3
+ import { BuildTask } from './build-task';
4
+ export type TaskHandler = {
5
+ handler: EnvHandler<Task>;
6
+ name: string;
7
+ };
8
+ /**
9
+ * create and maintain build pipelines for component
10
+ * dev environments.
11
+ */
12
+ export declare class Pipeline {
13
+ private _tasks;
14
+ constructor(_tasks: TaskHandler[]);
15
+ /**
16
+ * list all tasks in the build pipeline.
17
+ */
18
+ get tasks(): TaskHandler[];
19
+ private initiateTasks;
20
+ /**
21
+ * add a build task to the pipeline.
22
+ */
23
+ add(tasks: TaskHandler[]): this;
24
+ /**
25
+ * remove a build task from the pipeline.
26
+ */
27
+ remove(taskNames: string[]): this;
28
+ /**
29
+ * replace a build task in the pipeline.
30
+ */
31
+ replace(tasks: TaskHandler[]): this;
32
+ /**
33
+ * return a new pipeline with the tasks from the pipeline args added.
34
+ * @param pipeline
35
+ * @returns
36
+ */
37
+ concat(pipeline: Pipeline): Pipeline;
38
+ /**
39
+ * compute the pipeline.
40
+ */
41
+ compute(context: EnvContext): BuildTask[];
42
+ static from(tasks: TaskHandler[]): Pipeline;
43
+ }