@teambit/builder 0.0.555 → 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/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.555.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 -34
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/types.ts +0 -39
package/task-results-list.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { BitError } from '@teambit/bit-error';
|
|
3
|
-
import { BuildTaskHelper } from './build-task';
|
|
4
|
-
import { TasksQueue } from './tasks-queue';
|
|
5
|
-
import { TaskResults } from './build-pipe';
|
|
6
|
-
import { ComponentResult } from './types';
|
|
7
|
-
|
|
8
|
-
export class TaskResultsList {
|
|
9
|
-
constructor(
|
|
10
|
-
public tasksQueue: TasksQueue,
|
|
11
|
-
/**
|
|
12
|
-
* results of all tasks executed in the build pipeline.
|
|
13
|
-
*/
|
|
14
|
-
public tasksResults: TaskResults[]
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
hasErrors(): boolean {
|
|
18
|
-
return this.tasksResults.some((taskResult) => taskResult.componentsResults.find((c) => c.errors?.length));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
throwErrorsIfExist() {
|
|
22
|
-
const errorMessage = this.getErrorMessageFormatted();
|
|
23
|
-
if (errorMessage) {
|
|
24
|
-
throw new BitError(errorMessage);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* group errors from all tasks and show them nicely to the user
|
|
30
|
-
*/
|
|
31
|
-
public getErrorMessageFormatted(): string | null {
|
|
32
|
-
const tasksErrors: string[] = [];
|
|
33
|
-
let totalErrors = 0;
|
|
34
|
-
this.tasksResults.forEach((taskResult) => {
|
|
35
|
-
const compsWithErrors = taskResult.componentsResults.filter((c) => c.errors?.length);
|
|
36
|
-
if (!compsWithErrors.length) return;
|
|
37
|
-
const title = chalk.bold(
|
|
38
|
-
`Failed task ${tasksErrors.length + 1}: "${BuildTaskHelper.serializeId(taskResult.task)}" of env "${
|
|
39
|
-
taskResult.env.id
|
|
40
|
-
}"\n`
|
|
41
|
-
);
|
|
42
|
-
const errorsStr = compsWithErrors
|
|
43
|
-
.map((compWithErrors) => this.aggregateTaskErrorsToOneString(compWithErrors))
|
|
44
|
-
.join('\n\n');
|
|
45
|
-
const taskErrors = compsWithErrors.reduce((acc, current) => acc + (current.errors || []).length, 0);
|
|
46
|
-
const summery = `\n\nFound ${taskErrors} errors in ${compsWithErrors.length} components`;
|
|
47
|
-
totalErrors += taskErrors;
|
|
48
|
-
tasksErrors.push(title + errorsStr + summery);
|
|
49
|
-
});
|
|
50
|
-
if (!tasksErrors.length) return null;
|
|
51
|
-
const title = `\nThe following errors were found while running the build pipeline\n`;
|
|
52
|
-
const errorsStr = tasksErrors.join('\n\n');
|
|
53
|
-
const totalTasks = this.tasksQueue.length;
|
|
54
|
-
const totalFailed = tasksErrors.length;
|
|
55
|
-
const totalSucceed = this.tasksResults.length - totalFailed;
|
|
56
|
-
const totalSkipped = totalTasks - this.tasksResults.length;
|
|
57
|
-
const summery = `\n\n\n✖ Total ${totalTasks} tasks. ${totalSucceed} succeeded. ${totalFailed} failed. ${totalSkipped} skipped. Total errors: ${totalErrors}.`;
|
|
58
|
-
return title + errorsStr + summery;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private aggregateTaskErrorsToOneString(componentResult: ComponentResult) {
|
|
62
|
-
const rawErrors = componentResult.errors || [];
|
|
63
|
-
const errors = rawErrors.map((e) => (typeof e === 'string' ? e : e.toString()));
|
|
64
|
-
return `component: ${componentResult.component.id.toString()}\n${errors.join('\n')}`;
|
|
65
|
-
}
|
|
66
|
-
}
|
package/tasks-queue.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { EnvDefinition } from '@teambit/envs';
|
|
2
|
-
import { BuildTask, BuildTaskHelper } from './build-task';
|
|
3
|
-
import { InvalidTask } from './exceptions';
|
|
4
|
-
|
|
5
|
-
type EnvTask = { env: EnvDefinition; task: BuildTask };
|
|
6
|
-
|
|
7
|
-
export class TasksQueue extends Array<EnvTask> {
|
|
8
|
-
toString() {
|
|
9
|
-
return this.map(({ env, task }) => `env ${env.id}, task ${BuildTaskHelper.serializeId(task)}`).join('\n');
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* make sure tasks names are valid and there are no duplications
|
|
13
|
-
*/
|
|
14
|
-
validate() {
|
|
15
|
-
this.forEach(({ task }) => {
|
|
16
|
-
this.validateTaskName(task);
|
|
17
|
-
});
|
|
18
|
-
this.validateDuplications();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
private validateTaskName(task: BuildTask) {
|
|
22
|
-
if (!task.name) throw new InvalidTask(task.aspectId, 'name is missing');
|
|
23
|
-
const regexWord = /^\w+$/; // match any word: a-zA-Z0-9 and underscore.
|
|
24
|
-
const isValid = regexWord.test(task.name);
|
|
25
|
-
if (!isValid)
|
|
26
|
-
throw new InvalidTask(task.aspectId, `name "${task.name}" is invalid, only alphanumeric characters are allowed`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private validateDuplications() {
|
|
30
|
-
const uniqueTasks = this.map(({ env, task }) => `${env.id} ${task.aspectId}:${task.name}`);
|
|
31
|
-
uniqueTasks.forEach((uniqTask) => {
|
|
32
|
-
if (uniqueTasks.filter((u) => u === uniqTask).length > 1) {
|
|
33
|
-
throw new InvalidTask(
|
|
34
|
-
uniqTask,
|
|
35
|
-
'there are two or more tasks with the same name and aspectId in the same environment'
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": [
|
|
4
|
-
"es2019",
|
|
5
|
-
"DOM",
|
|
6
|
-
"ES6",
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
9
|
-
],
|
|
10
|
-
"target": "es2015",
|
|
11
|
-
"module": "commonjs",
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"esModuleInterop": true,
|
|
18
|
-
"outDir": "dist",
|
|
19
|
-
"composite": true,
|
|
20
|
-
"emitDeclarationOnly": true,
|
|
21
|
-
"experimentalDecorators": true,
|
|
22
|
-
"emitDecoratorMetadata": true,
|
|
23
|
-
"allowSyntheticDefaultImports": true,
|
|
24
|
-
"strictPropertyInitialization": false,
|
|
25
|
-
"strict": true,
|
|
26
|
-
"noImplicitAny": false,
|
|
27
|
-
"rootDir": ".",
|
|
28
|
-
"preserveConstEnums": true,
|
|
29
|
-
"resolveJsonModule": true
|
|
30
|
-
},
|
|
31
|
-
"exclude": [
|
|
32
|
-
"dist"
|
|
33
|
-
]
|
|
34
|
-
}
|
package/types/asset.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare module '*.png' {
|
|
2
|
-
const value: any;
|
|
3
|
-
export = value;
|
|
4
|
-
}
|
|
5
|
-
declare module '*.svg' {
|
|
6
|
-
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
-
|
|
8
|
-
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
-
const src: string;
|
|
10
|
-
export default src;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
|
-
declare module '*.jpg' {
|
|
15
|
-
const value: any;
|
|
16
|
-
export = value;
|
|
17
|
-
}
|
|
18
|
-
declare module '*.jpeg' {
|
|
19
|
-
const value: any;
|
|
20
|
-
export = value;
|
|
21
|
-
}
|
|
22
|
-
declare module '*.gif' {
|
|
23
|
-
const value: any;
|
|
24
|
-
export = value;
|
|
25
|
-
}
|
|
26
|
-
declare module '*.bmp' {
|
|
27
|
-
const value: any;
|
|
28
|
-
export = value;
|
|
29
|
-
}
|
package/types/style.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
declare module '*.module.css' {
|
|
2
|
-
const classes: { readonly [key: string]: string };
|
|
3
|
-
export default classes;
|
|
4
|
-
}
|
|
5
|
-
declare module '*.module.scss' {
|
|
6
|
-
const classes: { readonly [key: string]: string };
|
|
7
|
-
export default classes;
|
|
8
|
-
}
|
|
9
|
-
declare module '*.module.sass' {
|
|
10
|
-
const classes: { readonly [key: string]: string };
|
|
11
|
-
export default classes;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare module '*.module.less' {
|
|
15
|
-
const classes: { readonly [key: string]: string };
|
|
16
|
-
export default classes;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
declare module '*.less' {
|
|
20
|
-
const classes: { readonly [key: string]: string };
|
|
21
|
-
export default classes;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare module '*.css' {
|
|
25
|
-
const classes: { readonly [key: string]: string };
|
|
26
|
-
export default classes;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare module '*.sass' {
|
|
30
|
-
const classes: { readonly [key: string]: string };
|
|
31
|
-
export default classes;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
declare module '*.scss' {
|
|
35
|
-
const classes: { readonly [key: string]: string };
|
|
36
|
-
export default classes;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare module '*.mdx' {
|
|
40
|
-
const component: any;
|
|
41
|
-
export default component;
|
|
42
|
-
}
|
package/types.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Component } from '@teambit/component';
|
|
2
|
-
|
|
3
|
-
export type Serializable = {
|
|
4
|
-
toString(): string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type TaskMetadata = { [key: string]: Serializable };
|
|
8
|
-
|
|
9
|
-
export type ComponentResult = {
|
|
10
|
-
/**
|
|
11
|
-
* instance of the component
|
|
12
|
-
*/
|
|
13
|
-
component: Component;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* metadata generated during component build.
|
|
17
|
-
*/
|
|
18
|
-
metadata?: TaskMetadata;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* returning errors from build tasks will cause a pipeline failure and logs all returned errors.
|
|
22
|
-
*/
|
|
23
|
-
errors?: Array<Error | string>;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* warnings generated throughout the build task.
|
|
27
|
-
*/
|
|
28
|
-
warnings?: string[];
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* timestamp in milliseconds when the task started
|
|
32
|
-
*/
|
|
33
|
-
startTime?: number;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* timestamp in milliseconds when the task ended
|
|
37
|
-
*/
|
|
38
|
-
endTime?: number;
|
|
39
|
-
};
|