@teambit/builder 0.0.551 → 0.0.556
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/dist/artifact/artifact-definition.d.ts +35 -0
- package/dist/artifact/artifact-factory.d.ts +3 -0
- package/dist/artifact/artifact-list.d.ts +9 -0
- package/dist/artifact/artifact.d.ts +52 -1
- package/dist/build-pipe.d.ts +33 -1
- package/dist/build-pipeline-order.d.ts +30 -0
- package/dist/build-pipeline-result-list.d.ts +3 -0
- package/dist/build-task.d.ts +57 -0
- package/dist/builder.main.runtime.d.ts +27 -0
- package/dist/builder.service.d.ts +39 -1
- package/dist/storage/storage-resolver.d.ts +6 -0
- package/dist/task-results-list.d.ts +11 -1
- package/dist/tasks-queue.d.ts +3 -0
- package/dist/types.d.ts +18 -0
- package/package.json +23 -17
- package/artifact/artifact-definition.ts +0 -52
- package/artifact/artifact-extractor.ts +0 -116
- package/artifact/artifact-factory.ts +0 -119
- package/artifact/artifact-list.ts +0 -64
- package/artifact/artifact.ts +0 -81
- package/artifact/artifacts.cmd.ts +0 -68
- package/artifact/extension-artifact.ts +0 -12
- package/artifact/index.ts +0 -5
- package/build-pipe.ts +0 -167
- package/build-pipeline-order.ts +0 -197
- package/build-pipeline-result-list.ts +0 -97
- package/build-task.ts +0 -114
- package/build.cmd.ts +0 -91
- package/builder.aspect.ts +0 -5
- package/builder.docs.mdx +0 -8
- package/builder.graphql.ts +0 -38
- package/builder.main.runtime.ts +0 -346
- package/builder.service.tsx +0 -163
- package/exceptions/artifact-storage-error.ts +0 -7
- package/exceptions/capsule-not-found.ts +0 -7
- package/exceptions/index.ts +0 -3
- package/exceptions/invalid-task.ts +0 -7
- package/index.ts +0 -9
- package/package-tar/teambit-builder-0.0.551.tgz +0 -0
- package/pipeline/index.ts +0 -1
- package/pipeline/pipeline-results.ts +0 -1
- package/storage/default-resolver.ts +0 -13
- package/storage/index.ts +0 -2
- package/storage/s3-resolver.ts +0 -40
- package/storage/storage-resolver.ts +0 -18
- package/task-results-list.ts +0 -66
- package/tasks-queue.ts +0 -40
- package/tsconfig.json +0 -35
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/types.ts +0 -39
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
export declare type ArtifactDefinition = {
|
|
2
|
+
/**
|
|
3
|
+
* name of the artifact.
|
|
4
|
+
* e.g. a project might utilize two different artifacts for the same typescript compiler, one
|
|
5
|
+
* that generates ES5 files and another for ES6, this prop helps to distinguish between the two.
|
|
6
|
+
*/
|
|
2
7
|
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* aspect id that created the artifact. sometimes it's not the same as the task.id.
|
|
10
|
+
* e.g. teambit.compilation/compiler executes teambit.typescript/typescript code that generates dists artifacts
|
|
11
|
+
* the generatedBy in this case is the teambit.typescript/typescript while the task.id is
|
|
12
|
+
* teambit.compilation/compiler
|
|
13
|
+
*/
|
|
3
14
|
generatedBy?: string;
|
|
15
|
+
/**
|
|
16
|
+
* description of the artifact.
|
|
17
|
+
*/
|
|
4
18
|
description?: string;
|
|
19
|
+
/**
|
|
20
|
+
* glob patterns of files to include upon artifact creation. minimatch is used to match the patterns.
|
|
21
|
+
* e.g. ['*.ts', '!foo.ts'] matches all ts files but ignores foo.ts.
|
|
22
|
+
*/
|
|
5
23
|
globPatterns: string[];
|
|
24
|
+
/**
|
|
25
|
+
* define the root directory for reading the artifacts from the capsule file system.
|
|
26
|
+
* the rootDir must be unique per artifacts, otherwise we risk overriding data between artifacts.
|
|
27
|
+
*/
|
|
6
28
|
rootDir?: string;
|
|
29
|
+
/**
|
|
30
|
+
* adds a directory prefix for all artifact files.
|
|
31
|
+
*/
|
|
7
32
|
dirPrefix?: string;
|
|
33
|
+
/**
|
|
34
|
+
* determine the context of the artifact.
|
|
35
|
+
* default artifact context is `component`.
|
|
36
|
+
* "env" is useful when the same file is generated for all components, for example, "preview"
|
|
37
|
+
* task may create the same webpack file for all components of that env.
|
|
38
|
+
*/
|
|
8
39
|
context?: 'component' | 'env';
|
|
40
|
+
/**
|
|
41
|
+
* storage resolver. can be used to replace where artifacts are stored.
|
|
42
|
+
* default resolver persists artifacts on scope. (not recommended for large files!)
|
|
43
|
+
*/
|
|
9
44
|
storageResolver?: string;
|
|
10
45
|
};
|
|
@@ -17,5 +17,8 @@ export declare class ArtifactFactory {
|
|
|
17
17
|
private getStorageResolver;
|
|
18
18
|
private toComponentMap;
|
|
19
19
|
private getRootDir;
|
|
20
|
+
/**
|
|
21
|
+
* generate artifacts from a build context according to the spec defined in the artifact definitions.
|
|
22
|
+
*/
|
|
20
23
|
generate(context: BuildContext, defs: ArtifactDefinition[], task: BuildTask): ComponentMap<ArtifactList>;
|
|
21
24
|
}
|
|
@@ -7,11 +7,20 @@ export declare type ResolverMap = {
|
|
|
7
7
|
export declare class ArtifactList {
|
|
8
8
|
readonly artifacts: Artifact[];
|
|
9
9
|
constructor(artifacts: Artifact[]);
|
|
10
|
+
/**
|
|
11
|
+
* return an array of artifact objects.
|
|
12
|
+
*/
|
|
10
13
|
toArray(): Artifact[];
|
|
14
|
+
/**
|
|
15
|
+
* group artifacts by the storage resolver.
|
|
16
|
+
*/
|
|
11
17
|
groupByResolver(): ResolverMap;
|
|
12
18
|
toObject(): ArtifactObject[];
|
|
13
19
|
groupByTaskId(): {
|
|
14
20
|
[key: string]: Artifact;
|
|
15
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* store all artifacts using the configured storage resolvers.
|
|
24
|
+
*/
|
|
16
25
|
store(component: Component): Promise<void[]>;
|
|
17
26
|
}
|
|
@@ -3,17 +3,68 @@ import type { BuildTask } from '../build-task';
|
|
|
3
3
|
import type { StorageResolver } from '../storage';
|
|
4
4
|
import type { ArtifactDefinition } from './artifact-definition';
|
|
5
5
|
export declare class Artifact {
|
|
6
|
+
/**
|
|
7
|
+
* definition of the artifact.
|
|
8
|
+
*/
|
|
6
9
|
readonly def: ArtifactDefinition;
|
|
10
|
+
/**
|
|
11
|
+
* storage resolver. can be used to replace where artifacts are stored.
|
|
12
|
+
*/
|
|
7
13
|
readonly storageResolver: StorageResolver;
|
|
8
14
|
readonly files: ArtifactFiles;
|
|
15
|
+
/**
|
|
16
|
+
* join this with `this.paths` to get the absolute paths
|
|
17
|
+
*/
|
|
9
18
|
readonly rootDir: string;
|
|
19
|
+
/**
|
|
20
|
+
* the declaring task.
|
|
21
|
+
* todo: change this to taskDescriptor that has only the metadata of the task, so it could be
|
|
22
|
+
* saved into the model.
|
|
23
|
+
*/
|
|
10
24
|
readonly task: BuildTask;
|
|
25
|
+
/**
|
|
26
|
+
* timestamp of the artifact creation.
|
|
27
|
+
*/
|
|
11
28
|
readonly timestamp: number;
|
|
12
|
-
constructor(
|
|
29
|
+
constructor(
|
|
30
|
+
/**
|
|
31
|
+
* definition of the artifact.
|
|
32
|
+
*/
|
|
33
|
+
def: ArtifactDefinition,
|
|
34
|
+
/**
|
|
35
|
+
* storage resolver. can be used to replace where artifacts are stored.
|
|
36
|
+
*/
|
|
37
|
+
storageResolver: StorageResolver, files: ArtifactFiles,
|
|
38
|
+
/**
|
|
39
|
+
* join this with `this.paths` to get the absolute paths
|
|
40
|
+
*/
|
|
41
|
+
rootDir: string,
|
|
42
|
+
/**
|
|
43
|
+
* the declaring task.
|
|
44
|
+
* todo: change this to taskDescriptor that has only the metadata of the task, so it could be
|
|
45
|
+
* saved into the model.
|
|
46
|
+
*/
|
|
47
|
+
task: BuildTask,
|
|
48
|
+
/**
|
|
49
|
+
* timestamp of the artifact creation.
|
|
50
|
+
*/
|
|
51
|
+
timestamp?: number);
|
|
13
52
|
get storage(): StorageResolver;
|
|
53
|
+
/**
|
|
54
|
+
* name of the artifact.
|
|
55
|
+
*/
|
|
14
56
|
get name(): string;
|
|
57
|
+
/**
|
|
58
|
+
* description of the artifact.
|
|
59
|
+
*/
|
|
15
60
|
get description(): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* aspect id (string) that generated the artifact
|
|
63
|
+
*/
|
|
16
64
|
get generatedBy(): string;
|
|
65
|
+
/**
|
|
66
|
+
* archive all artifact files into a tar.
|
|
67
|
+
*/
|
|
17
68
|
tar(): void;
|
|
18
69
|
toObject(): ArtifactObject;
|
|
19
70
|
}
|
package/dist/build-pipe.d.ts
CHANGED
|
@@ -8,14 +8,36 @@ import { TasksQueue } from './tasks-queue';
|
|
|
8
8
|
import { EnvsBuildContext } from './builder.service';
|
|
9
9
|
import { TaskResultsList } from './task-results-list';
|
|
10
10
|
export declare type TaskResults = {
|
|
11
|
+
/**
|
|
12
|
+
* task itself. useful for getting its id/description later on.
|
|
13
|
+
*/
|
|
11
14
|
task: BuildTask;
|
|
15
|
+
/**
|
|
16
|
+
* environment were the task was running
|
|
17
|
+
*/
|
|
12
18
|
env: EnvDefinition;
|
|
19
|
+
/**
|
|
20
|
+
* component build results.
|
|
21
|
+
*/
|
|
13
22
|
componentsResults: ComponentResult[];
|
|
23
|
+
/**
|
|
24
|
+
* artifacts generated by the build pipeline.
|
|
25
|
+
* in case the task finished with errors, this prop is undefined.
|
|
26
|
+
*/
|
|
14
27
|
artifacts: ComponentMap<ArtifactList> | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* timestamp of start initiation.
|
|
30
|
+
*/
|
|
15
31
|
startTime: number;
|
|
32
|
+
/**
|
|
33
|
+
* timestamp of task completion.
|
|
34
|
+
*/
|
|
16
35
|
endTime: number;
|
|
17
36
|
};
|
|
18
37
|
export declare class BuildPipe {
|
|
38
|
+
/**
|
|
39
|
+
* array of services to apply on the components.
|
|
40
|
+
*/
|
|
19
41
|
readonly tasksQueue: TasksQueue;
|
|
20
42
|
readonly envsBuildContext: EnvsBuildContext;
|
|
21
43
|
readonly logger: Logger;
|
|
@@ -24,7 +46,14 @@ export declare class BuildPipe {
|
|
|
24
46
|
private failedDependencyTask;
|
|
25
47
|
private longProcessLogger;
|
|
26
48
|
private taskResults;
|
|
27
|
-
constructor(
|
|
49
|
+
constructor(
|
|
50
|
+
/**
|
|
51
|
+
* array of services to apply on the components.
|
|
52
|
+
*/
|
|
53
|
+
tasksQueue: TasksQueue, envsBuildContext: EnvsBuildContext, logger: Logger, artifactFactory: ArtifactFactory);
|
|
54
|
+
/**
|
|
55
|
+
* execute a pipeline of build tasks.
|
|
56
|
+
*/
|
|
28
57
|
execute(): Promise<TaskResultsList>;
|
|
29
58
|
private executePreBuild;
|
|
30
59
|
private executeTask;
|
|
@@ -32,5 +61,8 @@ export declare class BuildPipe {
|
|
|
32
61
|
private updateFailedDependencyTask;
|
|
33
62
|
private shouldSkipTask;
|
|
34
63
|
private getBuildContext;
|
|
64
|
+
/**
|
|
65
|
+
* create a build pipe from an array of tasks.
|
|
66
|
+
*/
|
|
35
67
|
static from(tasksQueue: TasksQueue, envsBuildContext: EnvsBuildContext, logger: Logger, artifactFactory: ArtifactFactory): BuildPipe;
|
|
36
68
|
}
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
import { EnvDefinition } from '@teambit/envs';
|
|
2
2
|
import type { TaskSlot } from './builder.main.runtime';
|
|
3
3
|
import { TasksQueue } from './tasks-queue';
|
|
4
|
+
/**
|
|
5
|
+
* there are two ways how to add tasks to build pipeline.
|
|
6
|
+
* 1. `getBuildPipe()` method of the env.
|
|
7
|
+
* 2. registering to the `builder.registerBuildTask()`.
|
|
8
|
+
*
|
|
9
|
+
* in the option #1, it's possible to determine the order. e.g. `getBuildPipe() { return [taskA, taskB, taskC]; }`
|
|
10
|
+
* in the option #2, the register happens once the extension is loaded, so there is no way to put
|
|
11
|
+
* one task before/after another task.
|
|
12
|
+
*
|
|
13
|
+
* To be able to determine the order, you can do the following
|
|
14
|
+
* 1. "task.location", it has two options "start" and "end". the rest are "middle".
|
|
15
|
+
* 2. "task.dependencies", the dependencies must be completed for all envs before this task starts.
|
|
16
|
+
* the dependencies are applicable inside a location and not across locations. see getLocation()
|
|
17
|
+
* or/and continue reading for more info about this.
|
|
18
|
+
*
|
|
19
|
+
* to determine the final order of the tasks, the following is done:
|
|
20
|
+
* 1. split all tasks to three groups: start, middle and end.
|
|
21
|
+
* 2. for each group define a dependencies graph for the tasks with "dependencies" prop and the pipeline.
|
|
22
|
+
* 3. start with the first group "start", toposort the dependencies graph and push the found tasks
|
|
23
|
+
* to a queue. once completed, iterate the pipeline and add all tasks to the queue.
|
|
24
|
+
* 4. do the same for the "middle" and "end" groups.
|
|
25
|
+
*
|
|
26
|
+
* the reason for splitting the tasks to the three groups and not using the "dependencies" field
|
|
27
|
+
* alone to determine the order is that the "start" and "end" groups are mostly core and "middle"
|
|
28
|
+
* is mostly the user entering tasks to the pipeline and we as the core don't know about the users
|
|
29
|
+
* tasks. For example, a core task "PublishComponent" must happen after the compiler, however, a
|
|
30
|
+
* user might have an env without a compiler. if we determine the order only by the dependencies
|
|
31
|
+
* field, the "PublishComponent" would have a dependency "compiler" and because in this case there
|
|
32
|
+
* is no compiler task, it would throw an error about missing dependencies.
|
|
33
|
+
*/
|
|
4
34
|
export declare function calculatePipelineOrder(taskSlot: TaskSlot, envs: EnvDefinition[], pipeNameOnEnv?: string, tasks?: string[], skipTests?: boolean): TasksQueue;
|
|
@@ -15,6 +15,9 @@ export declare type AspectData = {
|
|
|
15
15
|
aspectId: string;
|
|
16
16
|
data: Serializable;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Helper to get the data and artifacts from the TasksResultsList before saving during the tag
|
|
20
|
+
*/
|
|
18
21
|
export declare class BuildPipelineResultList {
|
|
19
22
|
private tasksResults;
|
|
20
23
|
private components;
|
package/dist/build-task.d.ts
CHANGED
|
@@ -6,24 +6,81 @@ import type { ArtifactDefinition } from './artifact';
|
|
|
6
6
|
import { TaskResultsList } from './task-results-list';
|
|
7
7
|
import { TaskResults } from './build-pipe';
|
|
8
8
|
export declare type TaskLocation = 'start' | 'end';
|
|
9
|
+
/**
|
|
10
|
+
* delimiter between task.aspectId and task.name
|
|
11
|
+
*/
|
|
9
12
|
export declare const TaskIdDelimiter = ":";
|
|
10
13
|
export interface BuildContext extends ExecutionContext {
|
|
14
|
+
/**
|
|
15
|
+
* all components about to be built/tagged.
|
|
16
|
+
*/
|
|
11
17
|
components: Component[];
|
|
18
|
+
/**
|
|
19
|
+
* network of capsules ready to be built.
|
|
20
|
+
*/
|
|
12
21
|
capsuleNetwork: Network;
|
|
22
|
+
/**
|
|
23
|
+
* data generated by tasks that were running before this task
|
|
24
|
+
*/
|
|
13
25
|
previousTasksResults: TaskResults[];
|
|
14
26
|
}
|
|
15
27
|
export interface BuildTask {
|
|
28
|
+
/**
|
|
29
|
+
* aspect id serialized of the creator of the task.
|
|
30
|
+
* todo: automate this so then it won't be needed to pass manually.
|
|
31
|
+
*/
|
|
16
32
|
aspectId: string;
|
|
33
|
+
/**
|
|
34
|
+
* name of the task. function as an identifier among other tasks of the same aspectId.
|
|
35
|
+
* spaces and special characters are not allowed. as a convention, use UpperCamelCase style.
|
|
36
|
+
* (e.g. TypescriptCompiler).
|
|
37
|
+
*/
|
|
17
38
|
name: string;
|
|
39
|
+
/**
|
|
40
|
+
* description of what the task does.
|
|
41
|
+
* if available, the logger will log it show it in the status-line.
|
|
42
|
+
*/
|
|
18
43
|
description?: string;
|
|
44
|
+
/**
|
|
45
|
+
* where to put the task, before the env pipeline or after
|
|
46
|
+
*/
|
|
19
47
|
location?: TaskLocation;
|
|
48
|
+
/**
|
|
49
|
+
* execute a task in a build context
|
|
50
|
+
*/
|
|
20
51
|
execute(context: BuildContext): Promise<BuiltTaskResult>;
|
|
52
|
+
/**
|
|
53
|
+
* run before the build pipeline has started. this is useful when some preparation are needed to
|
|
54
|
+
* be done on all envs before the build starts.
|
|
55
|
+
* e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will
|
|
56
|
+
* cause dependencies from other envs to get this tsconfig written.
|
|
57
|
+
*/
|
|
21
58
|
preBuild?(context: BuildContext): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* run after the build pipeline completed for all envs. useful for doing some cleanup on the
|
|
61
|
+
* capsules before the deployment starts.
|
|
62
|
+
*/
|
|
22
63
|
postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* needed if you want the task to be running only after the dependencies were completed
|
|
66
|
+
* for *all* envs.
|
|
67
|
+
* normally this is not needed because the build-pipeline runs the tasks in the same order
|
|
68
|
+
* they're located in the `getBuildPipe()` array and according to the task.location.
|
|
69
|
+
* the case where this is useful is when a task not only needs to be after another task, but also
|
|
70
|
+
* after all environments were running that task.
|
|
71
|
+
* a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use
|
|
72
|
+
* "aspectId:name", e.g. "teambit.compilation/compiler:TypescriptCompiler".
|
|
73
|
+
*/
|
|
23
74
|
dependencies?: string[];
|
|
24
75
|
}
|
|
25
76
|
export interface BuiltTaskResult {
|
|
77
|
+
/**
|
|
78
|
+
* build results for each of the components in the build context.
|
|
79
|
+
*/
|
|
26
80
|
componentsResults: ComponentResult[];
|
|
81
|
+
/**
|
|
82
|
+
* array of artifact definitions to generate after a successful build.
|
|
83
|
+
*/
|
|
27
84
|
artifacts?: ArtifactDefinition[];
|
|
28
85
|
}
|
|
29
86
|
export declare class BuildTaskHelper {
|
|
@@ -41,7 +41,13 @@ export declare class BuilderMain {
|
|
|
41
41
|
private storeArtifacts;
|
|
42
42
|
private pipelineResultsToBuilderData;
|
|
43
43
|
tagListener(components: Component[], options?: OnTagOpts, isolateOptions?: IsolateComponentsOptions): Promise<OnTagResults>;
|
|
44
|
+
/**
|
|
45
|
+
* register a new storage resolver.
|
|
46
|
+
*/
|
|
44
47
|
registerStorageResolver(storageResolver: StorageResolver): this;
|
|
48
|
+
/**
|
|
49
|
+
* get storage resolver by name. otherwise, returns default.
|
|
50
|
+
*/
|
|
45
51
|
getStorageResolver(name: string): StorageResolver | undefined;
|
|
46
52
|
getArtifactsVinylByExtension(component: Component, aspectName: string): Promise<ArtifactVinyl[]>;
|
|
47
53
|
getArtifactsVinylByExtensionAndName(component: Component, aspectName: string, name: string): Promise<ArtifactVinyl[]>;
|
|
@@ -51,6 +57,12 @@ export declare class BuilderMain {
|
|
|
51
57
|
getDataByAspect(component: Component, aspectName: string): Serializable | undefined;
|
|
52
58
|
getArtifacts(component: Component): ArtifactObject[] | undefined;
|
|
53
59
|
getBuilderData(component: Component): BuilderData | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* build given components for release.
|
|
62
|
+
* for each one of the envs it runs a series of tasks.
|
|
63
|
+
* in case of an error in a task, it stops the execution of that env and continue to the next
|
|
64
|
+
* env. at the end, the results contain the data and errors per env.
|
|
65
|
+
*/
|
|
54
66
|
build(components: Component[], isolateOptions?: IsolateComponentsOptions, builderOptions?: BuilderServiceOptions): Promise<TaskResultsList>;
|
|
55
67
|
runTagTasks(components: Component[], isolateOptions?: IsolateComponentsOptions): Promise<TaskResultsList>;
|
|
56
68
|
runSnapTasks(components: Component[], isolateOptions?: IsolateComponentsOptions): Promise<TaskResultsList>;
|
|
@@ -61,9 +73,24 @@ export declare class BuilderMain {
|
|
|
61
73
|
tagTasks: string[];
|
|
62
74
|
snapTasks: string[];
|
|
63
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* register a build task to apply on all component build pipelines.
|
|
78
|
+
* build happens on `bit build` and as part of `bit tag --persist`.
|
|
79
|
+
*/
|
|
64
80
|
registerBuildTasks(tasks: BuildTask[]): this;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated use registerTagTasks or registerSnapTasks
|
|
83
|
+
*/
|
|
65
84
|
registerDeployTasks(tasks: BuildTask[]): this;
|
|
85
|
+
/**
|
|
86
|
+
* tag tasks that don't get executed on `bit build`, only on `bit tag'.
|
|
87
|
+
* this pipeline is running once the build-pipeline has completed.
|
|
88
|
+
*/
|
|
66
89
|
registerTagTasks(tasks: BuildTask[]): this;
|
|
90
|
+
/**
|
|
91
|
+
* tag tasks that don't get executed on `bit build`, only on `bit snap'.
|
|
92
|
+
* this pipeline is running once the build-pipeline has completed.
|
|
93
|
+
*/
|
|
67
94
|
registerSnapTasks(tasks: BuildTask[]): this;
|
|
68
95
|
static slots: (((registerFn: () => string) => SlotRegistry<BuildTask>) | ((registerFn: () => string) => SlotRegistry<StorageResolver>))[];
|
|
69
96
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
@@ -33,15 +33,53 @@ export declare type BuilderDescriptor = Array<{
|
|
|
33
33
|
}>;
|
|
34
34
|
declare type PipeFunctionNames = keyof typeof pipeNames;
|
|
35
35
|
export declare class BuilderService implements EnvService<BuildServiceResults, BuilderDescriptor> {
|
|
36
|
+
/**
|
|
37
|
+
* isolator extension.
|
|
38
|
+
*/
|
|
36
39
|
private isolator;
|
|
40
|
+
/**
|
|
41
|
+
* logger extension.
|
|
42
|
+
*/
|
|
37
43
|
private logger;
|
|
44
|
+
/**
|
|
45
|
+
* task slot (e.g tasks registered by other extensions.).
|
|
46
|
+
*/
|
|
38
47
|
private taskSlot;
|
|
48
|
+
/**
|
|
49
|
+
* a method with such name should be implemented on the env in order to run the pipe tasks.
|
|
50
|
+
*/
|
|
39
51
|
private pipeNameOnEnv;
|
|
52
|
+
/**
|
|
53
|
+
* pipe name to display on the console during the execution
|
|
54
|
+
*/
|
|
40
55
|
private displayPipeName;
|
|
41
56
|
private artifactFactory;
|
|
42
57
|
private scope;
|
|
43
58
|
name: string;
|
|
44
|
-
constructor(
|
|
59
|
+
constructor(
|
|
60
|
+
/**
|
|
61
|
+
* isolator extension.
|
|
62
|
+
*/
|
|
63
|
+
isolator: IsolatorMain,
|
|
64
|
+
/**
|
|
65
|
+
* logger extension.
|
|
66
|
+
*/
|
|
67
|
+
logger: Logger,
|
|
68
|
+
/**
|
|
69
|
+
* task slot (e.g tasks registered by other extensions.).
|
|
70
|
+
*/
|
|
71
|
+
taskSlot: TaskSlot,
|
|
72
|
+
/**
|
|
73
|
+
* a method with such name should be implemented on the env in order to run the pipe tasks.
|
|
74
|
+
*/
|
|
75
|
+
pipeNameOnEnv: PipeFunctionNames,
|
|
76
|
+
/**
|
|
77
|
+
* pipe name to display on the console during the execution
|
|
78
|
+
*/
|
|
79
|
+
displayPipeName: string, artifactFactory: ArtifactFactory, scope: ScopeMain);
|
|
80
|
+
/**
|
|
81
|
+
* runs all tasks for all envs
|
|
82
|
+
*/
|
|
45
83
|
runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList>;
|
|
46
84
|
render(env: EnvDefinition): JSX.Element;
|
|
47
85
|
private renderOnePipe;
|
|
@@ -4,6 +4,12 @@ export declare type StoreResult = {
|
|
|
4
4
|
[path: string]: string;
|
|
5
5
|
};
|
|
6
6
|
export interface StorageResolver {
|
|
7
|
+
/**
|
|
8
|
+
* name of the storage resolver.
|
|
9
|
+
*/
|
|
7
10
|
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* store artifacts in the storage.
|
|
13
|
+
*/
|
|
8
14
|
store(component: Component, artifacts: ArtifactList): Promise<void>;
|
|
9
15
|
}
|
|
@@ -2,10 +2,20 @@ import { TasksQueue } from './tasks-queue';
|
|
|
2
2
|
import { TaskResults } from './build-pipe';
|
|
3
3
|
export declare class TaskResultsList {
|
|
4
4
|
tasksQueue: TasksQueue;
|
|
5
|
+
/**
|
|
6
|
+
* results of all tasks executed in the build pipeline.
|
|
7
|
+
*/
|
|
5
8
|
tasksResults: TaskResults[];
|
|
6
|
-
constructor(tasksQueue: TasksQueue,
|
|
9
|
+
constructor(tasksQueue: TasksQueue,
|
|
10
|
+
/**
|
|
11
|
+
* results of all tasks executed in the build pipeline.
|
|
12
|
+
*/
|
|
13
|
+
tasksResults: TaskResults[]);
|
|
7
14
|
hasErrors(): boolean;
|
|
8
15
|
throwErrorsIfExist(): void;
|
|
16
|
+
/**
|
|
17
|
+
* group errors from all tasks and show them nicely to the user
|
|
18
|
+
*/
|
|
9
19
|
getErrorMessageFormatted(): string | null;
|
|
10
20
|
private aggregateTaskErrorsToOneString;
|
|
11
21
|
}
|
package/dist/tasks-queue.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ declare type EnvTask = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare class TasksQueue extends Array<EnvTask> {
|
|
8
8
|
toString(): string;
|
|
9
|
+
/**
|
|
10
|
+
* make sure tasks names are valid and there are no duplications
|
|
11
|
+
*/
|
|
9
12
|
validate(): void;
|
|
10
13
|
private validateTaskName;
|
|
11
14
|
private validateDuplications;
|
package/dist/types.d.ts
CHANGED
|
@@ -6,10 +6,28 @@ export declare type TaskMetadata = {
|
|
|
6
6
|
[key: string]: Serializable;
|
|
7
7
|
};
|
|
8
8
|
export declare type ComponentResult = {
|
|
9
|
+
/**
|
|
10
|
+
* instance of the component
|
|
11
|
+
*/
|
|
9
12
|
component: Component;
|
|
13
|
+
/**
|
|
14
|
+
* metadata generated during component build.
|
|
15
|
+
*/
|
|
10
16
|
metadata?: TaskMetadata;
|
|
17
|
+
/**
|
|
18
|
+
* returning errors from build tasks will cause a pipeline failure and logs all returned errors.
|
|
19
|
+
*/
|
|
11
20
|
errors?: Array<Error | string>;
|
|
21
|
+
/**
|
|
22
|
+
* warnings generated throughout the build task.
|
|
23
|
+
*/
|
|
12
24
|
warnings?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* timestamp in milliseconds when the task started
|
|
27
|
+
*/
|
|
13
28
|
startTime?: number;
|
|
29
|
+
/**
|
|
30
|
+
* timestamp in milliseconds when the task ended
|
|
31
|
+
*/
|
|
14
32
|
endTime?: number;
|
|
15
33
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.556",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/pipelines/builder",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.pipelines",
|
|
8
8
|
"name": "builder",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.556"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"p-map-series": "2.1.0",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"globby": "11.0.1",
|
|
23
23
|
"@babel/runtime": "7.12.18",
|
|
24
24
|
"core-js": "^3.0.0",
|
|
25
|
-
"@teambit/component": "0.0.
|
|
26
|
-
"@teambit/envs": "0.0.
|
|
27
|
-
"@teambit/logger": "0.0.
|
|
28
|
-
"@teambit/tester": "0.0.
|
|
29
|
-
"@teambit/isolator": "0.0.
|
|
30
|
-
"@teambit/cli": "0.0.
|
|
31
|
-
"@teambit/workspace": "0.0.
|
|
32
|
-
"@teambit/aspect-loader": "0.0.
|
|
33
|
-
"@teambit/graphql": "0.0.
|
|
34
|
-
"@teambit/scope": "0.0.
|
|
35
|
-
"@teambit/bit-error": "0.0.
|
|
36
|
-
"@teambit/component-id": "0.0.
|
|
25
|
+
"@teambit/component": "0.0.556",
|
|
26
|
+
"@teambit/envs": "0.0.556",
|
|
27
|
+
"@teambit/logger": "0.0.472",
|
|
28
|
+
"@teambit/tester": "0.0.556",
|
|
29
|
+
"@teambit/isolator": "0.0.556",
|
|
30
|
+
"@teambit/cli": "0.0.387",
|
|
31
|
+
"@teambit/workspace": "0.0.556",
|
|
32
|
+
"@teambit/aspect-loader": "0.0.556",
|
|
33
|
+
"@teambit/graphql": "0.0.556",
|
|
34
|
+
"@teambit/scope": "0.0.556",
|
|
35
|
+
"@teambit/bit-error": "0.0.373",
|
|
36
|
+
"@teambit/component-id": "0.0.377"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/lodash": "4.14.165",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@types/jest": "^26.0.0",
|
|
46
46
|
"@types/react-dom": "^17.0.5",
|
|
47
47
|
"@types/node": "12.20.4",
|
|
48
|
-
"@teambit/pipelines.aspect-docs.builder": "0.0.
|
|
48
|
+
"@teambit/pipelines.aspect-docs.builder": "0.0.106"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@teambit/legacy": "1.0.
|
|
51
|
+
"@teambit/legacy": "1.0.173",
|
|
52
52
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
53
53
|
"react": "^16.8.0 || ^17.0.0"
|
|
54
54
|
},
|
|
@@ -76,12 +76,18 @@
|
|
|
76
76
|
"react": "-"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@teambit/legacy": "1.0.
|
|
79
|
+
"@teambit/legacy": "1.0.173",
|
|
80
80
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
81
81
|
"react": "^16.8.0 || ^17.0.0"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
+
"files": [
|
|
86
|
+
"dist",
|
|
87
|
+
"!dist/tsconfig.tsbuildinfo",
|
|
88
|
+
"README.md",
|
|
89
|
+
"README.mdx"
|
|
90
|
+
],
|
|
85
91
|
"private": false,
|
|
86
92
|
"engines": {
|
|
87
93
|
"node": ">=12.22.0"
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export type ArtifactDefinition = {
|
|
2
|
-
/**
|
|
3
|
-
* name of the artifact.
|
|
4
|
-
* e.g. a project might utilize two different artifacts for the same typescript compiler, one
|
|
5
|
-
* that generates ES5 files and another for ES6, this prop helps to distinguish between the two.
|
|
6
|
-
*/
|
|
7
|
-
name: string;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* aspect id that created the artifact. sometimes it's not the same as the task.id.
|
|
11
|
-
* e.g. teambit.compilation/compiler executes teambit.typescript/typescript code that generates dists artifacts
|
|
12
|
-
* the generatedBy in this case is the teambit.typescript/typescript while the task.id is
|
|
13
|
-
* teambit.compilation/compiler
|
|
14
|
-
*/
|
|
15
|
-
generatedBy?: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* description of the artifact.
|
|
19
|
-
*/
|
|
20
|
-
description?: string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* glob patterns of files to include upon artifact creation. minimatch is used to match the patterns.
|
|
24
|
-
* e.g. ['*.ts', '!foo.ts'] matches all ts files but ignores foo.ts.
|
|
25
|
-
*/
|
|
26
|
-
globPatterns: string[];
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* define the root directory for reading the artifacts from the capsule file system.
|
|
30
|
-
* the rootDir must be unique per artifacts, otherwise we risk overriding data between artifacts.
|
|
31
|
-
*/
|
|
32
|
-
rootDir?: string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* adds a directory prefix for all artifact files.
|
|
36
|
-
*/
|
|
37
|
-
dirPrefix?: string;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* determine the context of the artifact.
|
|
41
|
-
* default artifact context is `component`.
|
|
42
|
-
* "env" is useful when the same file is generated for all components, for example, "preview"
|
|
43
|
-
* task may create the same webpack file for all components of that env.
|
|
44
|
-
*/
|
|
45
|
-
context?: 'component' | 'env';
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* storage resolver. can be used to replace where artifacts are stored.
|
|
49
|
-
* default resolver persists artifacts on scope. (not recommended for large files!)
|
|
50
|
-
*/
|
|
51
|
-
storageResolver?: string;
|
|
52
|
-
};
|