@teambit/builder 0.0.770 → 0.0.771
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/artifact/artifact-extractor.ts +5 -2
- package/artifact/artifacts.cmd.ts +11 -4
- package/dist/artifact/artifact-extractor.d.ts +3 -2
- package/dist/artifact/artifact-extractor.js +5 -3
- package/dist/artifact/artifact-extractor.js.map +1 -1
- package/dist/artifact/artifacts.cmd.d.ts +5 -1
- package/dist/artifact/artifacts.cmd.js +18 -4
- package/dist/artifact/artifacts.cmd.js.map +1 -1
- package/package-tar/teambit-builder-0.0.771.tgz +0 -0
- package/package.json +15 -15
- package/preview-1656339215962.js +5 -0
- package/package-tar/teambit-builder-0.0.770.tgz +0 -0
- package/preview-1656041300679.js +0 -2
|
@@ -14,6 +14,7 @@ export type ExtractorResult = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type ExtractorArtifactResult = {
|
|
17
|
+
artifactName: string;
|
|
17
18
|
aspectId: string;
|
|
18
19
|
taskName: string;
|
|
19
20
|
files: string[];
|
|
@@ -33,12 +34,13 @@ export class ArtifactExtractor {
|
|
|
33
34
|
constructor(
|
|
34
35
|
private scope: ScopeMain,
|
|
35
36
|
private builder: BuilderMain,
|
|
36
|
-
private
|
|
37
|
+
private pattern: string,
|
|
37
38
|
private options: ArtifactsOpts
|
|
38
39
|
) {}
|
|
39
40
|
|
|
40
41
|
async list(): Promise<ExtractorResult[]> {
|
|
41
|
-
const
|
|
42
|
+
const ids = await this.scope.idsByPattern(this.pattern);
|
|
43
|
+
const components = await this.scope.loadMany(ids);
|
|
42
44
|
const artifactObjectsPerId: ArtifactObjectsPerId[] = components.map((component) => {
|
|
43
45
|
return {
|
|
44
46
|
id: component.id,
|
|
@@ -83,6 +85,7 @@ export class ArtifactExtractor {
|
|
|
83
85
|
return artifactObjectsPerId.map(({ id, artifacts }) => {
|
|
84
86
|
const results: ExtractorArtifactResult[] = artifacts.map((artifact) => {
|
|
85
87
|
return {
|
|
88
|
+
artifactName: artifact.name,
|
|
86
89
|
aspectId: artifact.task.id,
|
|
87
90
|
taskName: artifact.task.name || artifact.generatedBy,
|
|
88
91
|
files: artifact.files.refs.map((ref) => ref.relativePath),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
+
import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
|
|
3
4
|
import { ScopeMain } from '@teambit/scope';
|
|
4
5
|
import { BuilderMain } from '../builder.main.runtime';
|
|
5
6
|
import { ArtifactExtractor, ExtractorArtifactResult, ExtractorResultGrouped } from './artifact-extractor';
|
|
@@ -16,12 +17,18 @@ export type ArtifactsOpts = {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export class ArtifactsCmd implements Command {
|
|
19
|
-
name = 'artifacts <pattern
|
|
20
|
+
name = 'artifacts <component-pattern>';
|
|
20
21
|
description = 'EXPERIMENTAL. list and download components artifacts';
|
|
21
22
|
extendedDescription = `artifacts are created on isolated capsules during tag or snap commands.
|
|
22
23
|
example of artifacts are dists files generated by a compiler, a JUnit.xml file generated by a tester
|
|
23
24
|
and a package.tgz file generated by pkg aspect.
|
|
24
25
|
`;
|
|
26
|
+
arguments = [
|
|
27
|
+
{
|
|
28
|
+
name: 'component-pattern',
|
|
29
|
+
description: COMPONENT_PATTERN_HELP,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
25
32
|
alias = '';
|
|
26
33
|
group = 'development';
|
|
27
34
|
options = [
|
|
@@ -37,15 +44,15 @@ and a package.tgz file generated by pkg aspect.
|
|
|
37
44
|
|
|
38
45
|
constructor(private builder: BuilderMain, private scope: ScopeMain) {}
|
|
39
46
|
|
|
40
|
-
async report([
|
|
41
|
-
const artifactExtractor = new ArtifactExtractor(this.scope, this.builder,
|
|
47
|
+
async report([componentPattern]: [string], artifactsOpts: ArtifactsOpts): Promise<string> {
|
|
48
|
+
const artifactExtractor = new ArtifactExtractor(this.scope, this.builder, componentPattern, artifactsOpts);
|
|
42
49
|
const list = await artifactExtractor.list();
|
|
43
50
|
const grouped = artifactExtractor.groupResultsByAspect(list);
|
|
44
51
|
const outputArtifacts = (aspectId: string, artifactData: ExtractorArtifactResult[]) => {
|
|
45
52
|
const title = chalk.green(aspectId);
|
|
46
53
|
const artifactDataStr = artifactData
|
|
47
54
|
.map((artifact) => {
|
|
48
|
-
const subTitle = chalk.white(artifact.taskName);
|
|
55
|
+
const subTitle = chalk.white(`${artifact.taskName} (${artifact.artifactName})`);
|
|
49
56
|
const files = artifact.files.map((f) => INDENT_FILES + chalk.dim(f)).join('\n');
|
|
50
57
|
return `${INDENT_SUB_TITLE}${subTitle}\n${files}`;
|
|
51
58
|
})
|
|
@@ -7,6 +7,7 @@ export declare type ExtractorResult = {
|
|
|
7
7
|
artifacts: ExtractorArtifactResult[];
|
|
8
8
|
};
|
|
9
9
|
export declare type ExtractorArtifactResult = {
|
|
10
|
+
artifactName: string;
|
|
10
11
|
aspectId: string;
|
|
11
12
|
taskName: string;
|
|
12
13
|
files: string[];
|
|
@@ -20,9 +21,9 @@ export declare type ExtractorResultGrouped = {
|
|
|
20
21
|
export declare class ArtifactExtractor {
|
|
21
22
|
private scope;
|
|
22
23
|
private builder;
|
|
23
|
-
private
|
|
24
|
+
private pattern;
|
|
24
25
|
private options;
|
|
25
|
-
constructor(scope: ScopeMain, builder: BuilderMain,
|
|
26
|
+
constructor(scope: ScopeMain, builder: BuilderMain, pattern: string, options: ArtifactsOpts);
|
|
26
27
|
list(): Promise<ExtractorResult[]>;
|
|
27
28
|
groupResultsByAspect(extractorResult: ExtractorResult[]): {
|
|
28
29
|
id: ComponentID;
|
|
@@ -66,15 +66,16 @@ function _artifactFiles() {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
class ArtifactExtractor {
|
|
69
|
-
constructor(scope, builder,
|
|
69
|
+
constructor(scope, builder, pattern, options) {
|
|
70
70
|
this.scope = scope;
|
|
71
71
|
this.builder = builder;
|
|
72
|
-
this.
|
|
72
|
+
this.pattern = pattern;
|
|
73
73
|
this.options = options;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
async list() {
|
|
77
|
-
const
|
|
77
|
+
const ids = await this.scope.idsByPattern(this.pattern);
|
|
78
|
+
const components = await this.scope.loadMany(ids);
|
|
78
79
|
const artifactObjectsPerId = components.map(component => {
|
|
79
80
|
return {
|
|
80
81
|
id: component.id,
|
|
@@ -129,6 +130,7 @@ class ArtifactExtractor {
|
|
|
129
130
|
}) => {
|
|
130
131
|
const results = artifacts.map(artifact => {
|
|
131
132
|
return {
|
|
133
|
+
artifactName: artifact.name,
|
|
132
134
|
aspectId: artifact.task.id,
|
|
133
135
|
taskName: artifact.task.name || artifact.generatedBy,
|
|
134
136
|
files: artifact.files.refs.map(ref => ref.relativePath)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ArtifactExtractor","constructor","scope","builder","
|
|
1
|
+
{"version":3,"names":["ArtifactExtractor","constructor","scope","builder","pattern","options","list","ids","idsByPattern","components","loadMany","artifactObjectsPerId","map","component","id","artifacts","getArtifacts","filterByOptions","saveFilesInFileSystemIfAsked","artifactsObjectsToExtractorResults","groupResultsByAspect","extractorResult","result","reduce","acc","current","aspectId","push","outDir","pMapSeries","vinyls","Promise","all","artifactObject","files","getVinylsAndImportIfMissing","legacyScope","flattenedVinyls","flat","compPath","path","join","toStringWithoutVersion","vinyl","fs","outputFile","contents","results","artifact","artifactName","name","task","taskName","generatedBy","refs","ref","relativePath","aspect","forEach","item","filter","minimatch","ArtifactFiles","length"],"sources":["artifact-extractor.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport { ScopeMain } from '@teambit/scope';\nimport { ComponentID } from '@teambit/component-id';\nimport pMapSeries from 'p-map-series';\nimport minimatch from 'minimatch';\nimport { ArtifactFiles, ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { BuilderMain } from '../builder.main.runtime';\nimport { ArtifactsOpts } from './artifacts.cmd';\n\nexport type ExtractorResult = {\n id: ComponentID;\n artifacts: ExtractorArtifactResult[];\n};\n\nexport type ExtractorArtifactResult = {\n artifactName: string;\n aspectId: string;\n taskName: string;\n files: string[];\n};\n\nexport type ExtractorResultGrouped = {\n id: ComponentID;\n artifacts: { [aspectId: string]: ExtractorArtifactResult[] };\n};\n\ntype ArtifactObjectsPerId = {\n id: ComponentID;\n artifacts: ArtifactObject[];\n};\n\nexport class ArtifactExtractor {\n constructor(\n private scope: ScopeMain,\n private builder: BuilderMain,\n private pattern: string,\n private options: ArtifactsOpts\n ) {}\n\n async list(): Promise<ExtractorResult[]> {\n const ids = await this.scope.idsByPattern(this.pattern);\n const components = await this.scope.loadMany(ids);\n const artifactObjectsPerId: ArtifactObjectsPerId[] = components.map((component) => {\n return {\n id: component.id,\n artifacts: this.builder.getArtifacts(component) || [],\n };\n });\n this.filterByOptions(artifactObjectsPerId);\n await this.saveFilesInFileSystemIfAsked(artifactObjectsPerId);\n\n return this.artifactsObjectsToExtractorResults(artifactObjectsPerId);\n }\n\n groupResultsByAspect(extractorResult: ExtractorResult[]) {\n return extractorResult.map((result) => {\n const artifacts = result.artifacts.reduce((acc, current) => {\n (acc[current.aspectId] ||= []).push(current);\n return acc;\n }, {});\n return { id: result.id, artifacts };\n });\n }\n\n private async saveFilesInFileSystemIfAsked(artifactObjectsPerId: ArtifactObjectsPerId[]) {\n const outDir = this.options.outDir;\n if (!outDir) {\n return;\n }\n // @todo: optimize this to first import all missing hashes.\n await pMapSeries(artifactObjectsPerId, async ({ id, artifacts }) => {\n const vinyls = await Promise.all(\n artifacts.map((artifactObject) =>\n artifactObject.files.getVinylsAndImportIfMissing(id.scope as string, this.scope.legacyScope)\n )\n );\n const flattenedVinyls = vinyls.flat();\n const compPath = path.join(outDir, id.toStringWithoutVersion());\n await Promise.all(flattenedVinyls.map((vinyl) => fs.outputFile(path.join(compPath, vinyl.path), vinyl.contents)));\n });\n }\n\n private artifactsObjectsToExtractorResults(artifactObjectsPerId: ArtifactObjectsPerId[]): ExtractorResult[] {\n return artifactObjectsPerId.map(({ id, artifacts }) => {\n const results: ExtractorArtifactResult[] = artifacts.map((artifact) => {\n return {\n artifactName: artifact.name,\n aspectId: artifact.task.id,\n taskName: artifact.task.name || artifact.generatedBy,\n files: artifact.files.refs.map((ref) => ref.relativePath),\n };\n });\n return {\n id,\n artifacts: results,\n };\n });\n }\n\n private filterByOptions(artifactObjectsPerId: ArtifactObjectsPerId[]) {\n const { aspect, task, files } = this.options;\n artifactObjectsPerId.forEach((item) => {\n item.artifacts = item.artifacts.filter((artifact) => {\n if (aspect && aspect !== artifact.task.id) return false;\n if (task && task !== artifact.task.name) return false;\n return true;\n });\n if (files) {\n item.artifacts.forEach((artifact) => {\n const refs = artifact.files.refs.filter((ref) => minimatch(ref.relativePath, files));\n artifact.files = new ArtifactFiles([], [], refs);\n });\n // remove artifacts with no files\n item.artifacts = item.artifacts.filter((artifact) => artifact.files.refs.length);\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AA0BO,MAAMA,iBAAN,CAAwB;EAC7BC,WAAW,CACDC,KADC,EAEDC,OAFC,EAGDC,OAHC,EAIDC,OAJC,EAKT;IAAA,KAJQH,KAIR,GAJQA,KAIR;IAAA,KAHQC,OAGR,GAHQA,OAGR;IAAA,KAFQC,OAER,GAFQA,OAER;IAAA,KADQC,OACR,GADQA,OACR;EAAE;;EAEM,MAAJC,IAAI,GAA+B;IACvC,MAAMC,GAAG,GAAG,MAAM,KAAKL,KAAL,CAA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;MAAUN,IAAV;MAAgBjB;IAAhB,IAA0B,KAAK7B,OAArC;IACAM,oBAAoB,CAAC+C,OAArB,CAA8BC,IAAD,IAAU;MACrCA,IAAI,CAAC5C,SAAL,GAAiB4C,IAAI,CAAC5C,SAAL,CAAe6C,MAAf,CAAuBZ,QAAD,IAAc;QACnD,IAAIS,MAAM,IAAIA,MAAM,KAAKT,QAAQ,CAACG,IAAT,CAAcrC,EAAvC,EAA2C,OAAO,KAAP;QAC3C,IAAIqC,IAAI,IAAIA,IAAI,KAAKH,QAAQ,CAACG,IAAT,CAAcD,IAAnC,EAAyC,OAAO,KAAP;QACzC,OAAO,IAAP;MACD,CAJgB,CAAjB;;MAKA,IAAIhB,KAAJ,EAAW;QACTyB,IAAI,CAAC5C,SAAL,CAAe2C,OAAf,CAAwBV,QAAD,IAAc;UACnC,MAAMM,IAAI,GAAGN,QAAQ,CAACd,KAAT,CAAeoB,IAAf,CAAoBM,MAApB,CAA4BL,GAAD,IAAS,IAAAM,oBAAA,EAAUN,GAAG,CAACC,YAAd,EAA4BtB,KAA5B,CAApC,CAAb;UACAc,QAAQ,CAACd,KAAT,GAAiB,KAAI4B,8BAAJ,EAAkB,EAAlB,EAAsB,EAAtB,EAA0BR,IAA1B,CAAjB;QACD,CAHD,EADS,CAKT;;QACAK,IAAI,CAAC5C,SAAL,GAAiB4C,IAAI,CAAC5C,SAAL,CAAe6C,MAAf,CAAuBZ,QAAD,IAAcA,QAAQ,CAACd,KAAT,CAAeoB,IAAf,CAAoBS,MAAxD,CAAjB;MACD;IACF,CAdD;EAeD;;AArF4B"}
|
|
@@ -13,9 +13,13 @@ export declare class ArtifactsCmd implements Command {
|
|
|
13
13
|
name: string;
|
|
14
14
|
description: string;
|
|
15
15
|
extendedDescription: string;
|
|
16
|
+
arguments: {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}[];
|
|
16
20
|
alias: string;
|
|
17
21
|
group: string;
|
|
18
22
|
options: CommandOptions;
|
|
19
23
|
constructor(builder: BuilderMain, scope: ScopeMain);
|
|
20
|
-
report([
|
|
24
|
+
report([componentPattern]: [string], artifactsOpts: ArtifactsOpts): Promise<string>;
|
|
21
25
|
}
|
|
@@ -31,6 +31,16 @@ function _chalk() {
|
|
|
31
31
|
return data;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function _constants() {
|
|
35
|
+
const data = require("@teambit/legacy/dist/constants");
|
|
36
|
+
|
|
37
|
+
_constants = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
function _artifactExtractor() {
|
|
35
45
|
const data = require("./artifact-extractor");
|
|
36
46
|
|
|
@@ -49,19 +59,23 @@ class ArtifactsCmd {
|
|
|
49
59
|
constructor(builder, scope) {
|
|
50
60
|
this.builder = builder;
|
|
51
61
|
this.scope = scope;
|
|
52
|
-
(0, _defineProperty2().default)(this, "name", 'artifacts <pattern
|
|
62
|
+
(0, _defineProperty2().default)(this, "name", 'artifacts <component-pattern>');
|
|
53
63
|
(0, _defineProperty2().default)(this, "description", 'EXPERIMENTAL. list and download components artifacts');
|
|
54
64
|
(0, _defineProperty2().default)(this, "extendedDescription", `artifacts are created on isolated capsules during tag or snap commands.
|
|
55
65
|
example of artifacts are dists files generated by a compiler, a JUnit.xml file generated by a tester
|
|
56
66
|
and a package.tgz file generated by pkg aspect.
|
|
57
67
|
`);
|
|
68
|
+
(0, _defineProperty2().default)(this, "arguments", [{
|
|
69
|
+
name: 'component-pattern',
|
|
70
|
+
description: _constants().COMPONENT_PATTERN_HELP
|
|
71
|
+
}]);
|
|
58
72
|
(0, _defineProperty2().default)(this, "alias", '');
|
|
59
73
|
(0, _defineProperty2().default)(this, "group", 'development');
|
|
60
74
|
(0, _defineProperty2().default)(this, "options", [['', 'aspect <aspect-id>', 'show/download only artifacts generated by this aspect-id'], ['', 'task <task-id>', 'show/download only artifacts generated by this task-id'], ['', 'files <glob>', 'show/download only artifacts matching the given files or the glob pattern (wrap glob patterns in quotes)'], ['', 'out-dir <string>', 'download the files to the specified dir']]);
|
|
61
75
|
}
|
|
62
76
|
|
|
63
|
-
async report([
|
|
64
|
-
const artifactExtractor = new (_artifactExtractor().ArtifactExtractor)(this.scope, this.builder,
|
|
77
|
+
async report([componentPattern], artifactsOpts) {
|
|
78
|
+
const artifactExtractor = new (_artifactExtractor().ArtifactExtractor)(this.scope, this.builder, componentPattern, artifactsOpts);
|
|
65
79
|
const list = await artifactExtractor.list();
|
|
66
80
|
const grouped = artifactExtractor.groupResultsByAspect(list);
|
|
67
81
|
|
|
@@ -69,7 +83,7 @@ and a package.tgz file generated by pkg aspect.
|
|
|
69
83
|
const title = _chalk().default.green(aspectId);
|
|
70
84
|
|
|
71
85
|
const artifactDataStr = artifactData.map(artifact => {
|
|
72
|
-
const subTitle = _chalk().default.white(artifact.taskName);
|
|
86
|
+
const subTitle = _chalk().default.white(`${artifact.taskName} (${artifact.artifactName})`);
|
|
73
87
|
|
|
74
88
|
const files = artifact.files.map(f => INDENT_FILES + _chalk().default.dim(f)).join('\n');
|
|
75
89
|
return `${INDENT_SUB_TITLE}${subTitle}\n${files}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["INDENT_TITLE","repeat","INDENT_SUB_TITLE","INDENT_FILES","ArtifactsCmd","constructor","builder","scope","report","
|
|
1
|
+
{"version":3,"names":["INDENT_TITLE","repeat","INDENT_SUB_TITLE","INDENT_FILES","ArtifactsCmd","constructor","builder","scope","name","description","COMPONENT_PATTERN_HELP","report","componentPattern","artifactsOpts","artifactExtractor","ArtifactExtractor","list","grouped","groupResultsByAspect","outputArtifacts","aspectId","artifactData","title","chalk","green","artifactDataStr","map","artifact","subTitle","white","taskName","artifactName","files","f","dim","join","outputResult","result","idStr","cyan","id","toString","artifacts","Object","keys","footer","outDir"],"sources":["artifacts.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { ScopeMain } from '@teambit/scope';\nimport { BuilderMain } from '../builder.main.runtime';\nimport { ArtifactExtractor, ExtractorArtifactResult, ExtractorResultGrouped } from './artifact-extractor';\n\nconst INDENT_TITLE = ' '.repeat(2);\nconst INDENT_SUB_TITLE = ' '.repeat(4);\nconst INDENT_FILES = ' '.repeat(6);\n\nexport type ArtifactsOpts = {\n aspect?: string;\n task?: string;\n files?: string;\n outDir?: string;\n};\n\nexport class ArtifactsCmd implements Command {\n name = 'artifacts <component-pattern>';\n description = 'EXPERIMENTAL. list and download components artifacts';\n extendedDescription = `artifacts are created on isolated capsules during tag or snap commands.\nexample of artifacts are dists files generated by a compiler, a JUnit.xml file generated by a tester\nand a package.tgz file generated by pkg aspect.\n`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = '';\n group = 'development';\n options = [\n ['', 'aspect <aspect-id>', 'show/download only artifacts generated by this aspect-id'],\n ['', 'task <task-id>', 'show/download only artifacts generated by this task-id'],\n [\n '',\n 'files <glob>',\n 'show/download only artifacts matching the given files or the glob pattern (wrap glob patterns in quotes)',\n ],\n ['', 'out-dir <string>', 'download the files to the specified dir'],\n ] as CommandOptions;\n\n constructor(private builder: BuilderMain, private scope: ScopeMain) {}\n\n async report([componentPattern]: [string], artifactsOpts: ArtifactsOpts): Promise<string> {\n const artifactExtractor = new ArtifactExtractor(this.scope, this.builder, componentPattern, artifactsOpts);\n const list = await artifactExtractor.list();\n const grouped = artifactExtractor.groupResultsByAspect(list);\n const outputArtifacts = (aspectId: string, artifactData: ExtractorArtifactResult[]) => {\n const title = chalk.green(aspectId);\n const artifactDataStr = artifactData\n .map((artifact) => {\n const subTitle = chalk.white(`${artifact.taskName} (${artifact.artifactName})`);\n const files = artifact.files.map((f) => INDENT_FILES + chalk.dim(f)).join('\\n');\n return `${INDENT_SUB_TITLE}${subTitle}\\n${files}`;\n })\n .join('\\n');\n return `${INDENT_TITLE}${title}\\n${artifactDataStr}`;\n };\n const outputResult = (result: ExtractorResultGrouped) => {\n const idStr = chalk.cyan(result.id.toString());\n const artifacts = Object.keys(result.artifacts)\n .map((aspectId) => outputArtifacts(aspectId, result.artifacts[aspectId]))\n .join('\\n\\n');\n return `${idStr}\\n${artifacts}`;\n };\n const footer = artifactsOpts.outDir\n ? chalk.green('\\n\\nThe above files were saved successfully to the file system')\n : '';\n return grouped.map(outputResult).join('\\n\\n') + footer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA,MAAMA,YAAY,GAAG,IAAIC,MAAJ,CAAW,CAAX,CAArB;AACA,MAAMC,gBAAgB,GAAG,IAAID,MAAJ,CAAW,CAAX,CAAzB;AACA,MAAME,YAAY,GAAG,IAAIF,MAAJ,CAAW,CAAX,CAArB;;AASO,MAAMG,YAAN,CAAsC;EA0B3CC,WAAW,CAASC,OAAT,EAAuCC,KAAvC,EAAyD;IAAA,KAAhDD,OAAgD,GAAhDA,OAAgD;IAAA,KAAlBC,KAAkB,GAAlBA,KAAkB;IAAA,8CAzB7D,+BAyB6D;IAAA,qDAxBtD,sDAwBsD;IAAA,6DAvB7C;AACzB;AACA;AACA,CAoBsE;IAAA,mDAnBxD,CACV;MACEC,IAAI,EAAE,mBADR;MAEEC,WAAW,EAAEC;IAFf,CADU,CAmBwD;IAAA,+CAb5D,EAa4D;IAAA,+CAZ5D,aAY4D;IAAA,iDAX1D,CACR,CAAC,EAAD,EAAK,oBAAL,EAA2B,0DAA3B,CADQ,EAER,CAAC,EAAD,EAAK,gBAAL,EAAuB,wDAAvB,CAFQ,EAGR,CACE,EADF,EAEE,cAFF,EAGE,0GAHF,CAHQ,EAQR,CAAC,EAAD,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AAYP,MAAM,CAACK,SAAnB,EACfhB,GADe,CACVN,QAAD,IAAcD,eAAe,CAACC,QAAD,EAAWiB,MAAM,CAACK,SAAP,CAAiBtB,QAAjB,CAAX,CADlB,EAEfe,IAFe,CAEV,MAFU,CAAlB;MAGA,OAAQ,GAAEG,KAAM,KAAII,SAAU,EAA9B;IACD,CAND;;IAOA,MAAMG,MAAM,GAAGhC,aAAa,CAACiC,MAAd,GACXvB,gBAAA,CAAMC,KAAN,CAAY,gEAAZ,CADW,GAEX,EAFJ;IAGA,OAAOP,OAAO,CAACS,GAAR,CAAYU,YAAZ,EAA0BD,IAA1B,CAA+B,MAA/B,IAAyCU,MAAhD;EACD;;AAtD0C"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/builder",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.771",
|
|
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.771"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"p-map-series": "2.1.0",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"core-js": "^3.0.0",
|
|
23
23
|
"@teambit/graph.cleargraph": "0.0.1",
|
|
24
24
|
"@teambit/harmony": "0.3.3",
|
|
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/generator": "0.0.
|
|
34
|
-
"@teambit/graphql": "0.0.
|
|
35
|
-
"@teambit/scope": "0.0.
|
|
25
|
+
"@teambit/component": "0.0.771",
|
|
26
|
+
"@teambit/envs": "0.0.771",
|
|
27
|
+
"@teambit/logger": "0.0.603",
|
|
28
|
+
"@teambit/tester": "0.0.771",
|
|
29
|
+
"@teambit/isolator": "0.0.771",
|
|
30
|
+
"@teambit/cli": "0.0.510",
|
|
31
|
+
"@teambit/workspace": "0.0.771",
|
|
32
|
+
"@teambit/aspect-loader": "0.0.771",
|
|
33
|
+
"@teambit/generator": "0.0.771",
|
|
34
|
+
"@teambit/graphql": "0.0.771",
|
|
35
|
+
"@teambit/scope": "0.0.771",
|
|
36
36
|
"@teambit/bit-error": "0.0.394",
|
|
37
37
|
"@teambit/component-id": "0.0.402"
|
|
38
38
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@teambit/pipelines.aspect-docs.builder": "0.0.138"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@teambit/legacy": "1.0.
|
|
52
|
+
"@teambit/legacy": "1.0.291",
|
|
53
53
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
54
54
|
"react": "^16.8.0 || ^17.0.0"
|
|
55
55
|
},
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"react": "-"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@teambit/legacy": "1.0.
|
|
80
|
+
"@teambit/legacy": "1.0.291",
|
|
81
81
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
82
82
|
"react": "^16.8.0 || ^17.0.0"
|
|
83
83
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.771/dist/builder.composition.js'
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.771/dist/builder.docs.mdx'
|
|
3
|
+
|
|
4
|
+
export const compositions = [compositions_0];
|
|
5
|
+
export const overview = [overview_0]
|
|
Binary file
|
package/preview-1656041300679.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.770/dist/builder.composition.js')]
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.770/dist/builder.docs.mdx')]
|