@teambit/builder 1.0.228 → 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.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_pipelines_builder-preview.js +1 -1
- package/artifacts/schema.json +706 -180
- package/dist/artifact/artifact-definition.d.ts +65 -0
- package/dist/artifact/artifact-extractor.d.ts +35 -0
- package/dist/artifact/artifact-factory.d.ts +20 -0
- package/dist/artifact/artifact-list.d.ts +52 -0
- package/dist/artifact/artifact.d.ts +59 -0
- package/dist/artifact/artifacts.cmd.d.ts +26 -0
- package/dist/artifact/extension-artifact.d.ts +10 -0
- package/dist/artifact/fs-artifact.d.ts +18 -0
- package/dist/artifact/index.d.ts +6 -0
- package/dist/build-pipe.d.ts +75 -0
- package/dist/build-pipeline-order.d.ts +35 -0
- package/dist/build-pipeline-result-list.d.ts +34 -0
- package/dist/build-task.d.ts +128 -0
- package/dist/build.cmd.d.ts +39 -0
- package/dist/builder-env-type.d.ts +15 -0
- package/dist/builder.aspect.d.ts +2 -0
- package/dist/builder.composition.d.ts +1 -0
- package/dist/builder.graphql.d.ts +102 -0
- package/dist/builder.main.runtime.d.ts +153 -0
- package/dist/builder.route.d.ts +20 -0
- package/dist/builder.service.d.ts +105 -0
- package/dist/exceptions/artifact-definition-no-glob.d.ts +3 -0
- package/dist/exceptions/artifact-storage-error.d.ts +7 -0
- package/dist/exceptions/capsule-not-found.d.ts +5 -0
- package/dist/exceptions/index.d.ts +3 -0
- package/dist/exceptions/invalid-task.d.ts +5 -0
- package/dist/index.d.ts +19 -0
- package/dist/pipeline/index.d.ts +1 -0
- package/dist/pipeline/pipeline-results.d.ts +2 -0
- package/dist/pipeline.d.ts +43 -0
- package/dist/{preview-1712805335812.js → preview-1712822929999.js} +2 -2
- package/dist/storage/default-resolver.d.ts +7 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/s3-resolver.d.ts +0 -0
- package/dist/storage/storage-resolver.d.ts +26 -0
- package/dist/task-results-list.d.ts +22 -0
- package/dist/task.d.ts +44 -0
- package/dist/tasks-queue.d.ts +16 -0
- package/dist/templates/build-task/files/index-file.d.ts +2 -0
- package/dist/templates/build-task/files/task-file.d.ts +2 -0
- package/dist/templates/build-task/index.d.ts +2 -0
- package/dist/types.d.ts +32 -0
- package/package.json +18 -18
- package/tsconfig.json +1 -49
|
@@ -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,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
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -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,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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.229/dist/builder.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.229/dist/builder.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Component } from '@teambit/component';
|
|
2
|
+
import { FsArtifact } from '../artifact';
|
|
3
|
+
import { WholeArtifactStorageResolver } from './storage-resolver';
|
|
4
|
+
export declare class DefaultResolver implements WholeArtifactStorageResolver {
|
|
5
|
+
name: string;
|
|
6
|
+
store(component: Component, artifact: FsArtifact): Promise<void>;
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Component } from '@teambit/component';
|
|
2
|
+
import { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';
|
|
3
|
+
import { FsArtifact } from '../artifact';
|
|
4
|
+
export type StoreResult = {
|
|
5
|
+
[path: string]: string;
|
|
6
|
+
};
|
|
7
|
+
interface BaseStorageResolver {
|
|
8
|
+
/**
|
|
9
|
+
* name of the storage resolver.
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WholeArtifactStorageResolver extends BaseStorageResolver {
|
|
14
|
+
/**
|
|
15
|
+
* store artifacts in the storage.
|
|
16
|
+
*/
|
|
17
|
+
store(component: Component, artifact: FsArtifact): Promise<StoreResult | undefined | void>;
|
|
18
|
+
}
|
|
19
|
+
export interface FileStorageResolver extends BaseStorageResolver {
|
|
20
|
+
/**
|
|
21
|
+
* store artifacts in the storage.
|
|
22
|
+
*/
|
|
23
|
+
storeFile(component: Component, artifact: FsArtifact, file: ArtifactVinyl): Promise<string | undefined | void>;
|
|
24
|
+
}
|
|
25
|
+
export type ArtifactStorageResolver = FileStorageResolver | WholeArtifactStorageResolver;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TasksQueue } from './tasks-queue';
|
|
2
|
+
import { TaskResults } from './build-pipe';
|
|
3
|
+
export declare class TaskResultsList {
|
|
4
|
+
tasksQueue: TasksQueue;
|
|
5
|
+
/**
|
|
6
|
+
* results of all tasks executed in the build pipeline.
|
|
7
|
+
*/
|
|
8
|
+
tasksResults: TaskResults[];
|
|
9
|
+
capsuleRootDir: string;
|
|
10
|
+
constructor(tasksQueue: TasksQueue,
|
|
11
|
+
/**
|
|
12
|
+
* results of all tasks executed in the build pipeline.
|
|
13
|
+
*/
|
|
14
|
+
tasksResults: TaskResults[], capsuleRootDir: string);
|
|
15
|
+
hasErrors(): boolean;
|
|
16
|
+
throwErrorsIfExist(): void;
|
|
17
|
+
/**
|
|
18
|
+
* group errors from all tasks and show them nicely to the user
|
|
19
|
+
*/
|
|
20
|
+
getErrorMessageFormatted(): string | null;
|
|
21
|
+
private aggregateTaskErrorsToOneString;
|
|
22
|
+
}
|
package/dist/task.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BuildContext, BuiltTaskResult } from './build-task';
|
|
2
|
+
import { TaskResultsList } from './task-results-list';
|
|
3
|
+
/**
|
|
4
|
+
* this is the external interface for task. please make
|
|
5
|
+
* sure to use only this interface outside of this builder
|
|
6
|
+
* aspect.
|
|
7
|
+
*/
|
|
8
|
+
export interface Task {
|
|
9
|
+
/**
|
|
10
|
+
* names ideally with dashes 'typescript'
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* description of what the task does.
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* execute a task in a build context
|
|
19
|
+
*/
|
|
20
|
+
execute(context: BuildContext): Promise<BuiltTaskResult>;
|
|
21
|
+
/**
|
|
22
|
+
* run before the build pipeline has started. this is useful when some preparation are needed to
|
|
23
|
+
* be done on all envs before the build starts.
|
|
24
|
+
* e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will
|
|
25
|
+
* cause dependencies from other envs to get this tsconfig written.
|
|
26
|
+
*/
|
|
27
|
+
preBuild?(context: BuildContext): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* run after the build pipeline completed for all envs. useful for doing some cleanup on the
|
|
30
|
+
* capsules before the deployment starts.
|
|
31
|
+
*/
|
|
32
|
+
postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* needed if you want the task to be running only after the dependencies were completed
|
|
35
|
+
* for *all* envs.
|
|
36
|
+
* normally this is not needed because the build-pipeline runs the tasks in the same order
|
|
37
|
+
* they're located in the `getBuildPipe()` array and according to the task.location.
|
|
38
|
+
* the case where this is useful is when a task not only needs to be after another task, but also
|
|
39
|
+
* after all environments were running that task.
|
|
40
|
+
* a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use
|
|
41
|
+
* "aspectId:name", e.g. "teambit.compilation/compiler:TypescriptCompiler".
|
|
42
|
+
*/
|
|
43
|
+
dependencies?: string[];
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EnvDefinition } from '@teambit/envs';
|
|
2
|
+
import { BuildTask } from './build-task';
|
|
3
|
+
type EnvTask = {
|
|
4
|
+
env: EnvDefinition;
|
|
5
|
+
task: BuildTask;
|
|
6
|
+
};
|
|
7
|
+
export declare class TasksQueue extends Array<EnvTask> {
|
|
8
|
+
toString(): string;
|
|
9
|
+
/**
|
|
10
|
+
* make sure tasks names are valid and there are no duplications
|
|
11
|
+
*/
|
|
12
|
+
validate(): void;
|
|
13
|
+
private validateTaskName;
|
|
14
|
+
private validateDuplications;
|
|
15
|
+
}
|
|
16
|
+
export {};
|