@teambit/builder 0.0.1083 → 0.0.1085

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.
@@ -29,6 +29,7 @@ export type BuilderServiceOptions = {
29
29
  previousTasksResults?: TaskResults[];
30
30
  dev?: boolean;
31
31
  exitOnFirstFailedTask?: boolean;
32
+ capsulesBaseDir?: string;
32
33
  };
33
34
 
34
35
  type BuilderTransformationMap = ServiceTransformationMap & {
@@ -100,16 +101,19 @@ export class BuilderService implements EnvService<BuildServiceResults, BuilderDe
100
101
  const longProcessLogger = this.logger.createLongProcessLogger(title);
101
102
  this.logger.consoleTitle(title);
102
103
  const envsBuildContext: EnvsBuildContext = {};
104
+ const isolateOpts = {
105
+ baseDir: options.capsulesBaseDir,
106
+ useHash: !options.capsulesBaseDir,
107
+ getExistingAsIs: true,
108
+ seedersOnly: options.seedersOnly,
109
+ };
103
110
  await pMapSeries(envsExecutionContext, async (executionContext) => {
104
111
  const componentIds = executionContext.components.map((component) => component.id);
105
112
  const { originalSeeders } = options;
106
113
  const originalSeedersOfThisEnv = componentIds.filter((compId) =>
107
114
  originalSeeders ? originalSeeders.find((seeder) => compId.isEqual(seeder)) : true
108
115
  );
109
- const capsuleNetwork = await this.isolator.isolateComponents(componentIds, {
110
- getExistingAsIs: true,
111
- seedersOnly: options.seedersOnly,
112
- });
116
+ const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOpts);
113
117
  capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;
114
118
  this.logger.console(
115
119
  `generated graph for env "${executionContext.id}", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`
@@ -6,6 +6,7 @@ import { Component, ComponentMap, IComponent, ComponentMain, ComponentID } from
6
6
  import { EnvsMain } from '@teambit/envs';
7
7
  import { GraphqlMain } from '@teambit/graphql';
8
8
  import { SlotRegistry } from '@teambit/harmony';
9
+ import { GlobalConfigMain } from '@teambit/global-config';
9
10
  import { LoggerMain } from '@teambit/logger';
10
11
  import { ScopeMain } from '@teambit/scope';
11
12
  import { Workspace } from '@teambit/workspace';
@@ -57,10 +58,11 @@ export declare class BuilderMain {
57
58
  private isolator;
58
59
  private aspectLoader;
59
60
  private componentAspect;
61
+ private globalConfig;
60
62
  private buildTaskSlot;
61
63
  private tagTaskSlot;
62
64
  private snapTaskSlot;
63
- constructor(envs: EnvsMain, workspace: Workspace, buildService: BuilderService, tagService: BuilderService, snapService: BuilderService, scope: ScopeMain, isolator: IsolatorMain, aspectLoader: AspectLoaderMain, componentAspect: ComponentMain, buildTaskSlot: TaskSlot, tagTaskSlot: TaskSlot, snapTaskSlot: TaskSlot);
65
+ 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);
64
66
  private storeArtifacts;
65
67
  private pipelineResultsToBuilderData;
66
68
  tagListener(components: Component[], options?: OnTagOpts, isolateOptions?: IsolateComponentsOptions, builderOptions?: BuilderServiceOptions): Promise<OnTagResults>;
@@ -77,6 +79,7 @@ export declare class BuilderMain {
77
79
  getArtifacts(component: IComponent): ArtifactList<Artifact>;
78
80
  getBuilderData(component: IComponent): BuilderData | undefined;
79
81
  build(components: Component[], isolateOptions?: IsolateComponentsOptions, builderOptions?: BuilderServiceOptions): Promise<TaskResultsList>;
82
+ getComponentsCapsulesBaseDir(): string | undefined;
80
83
  runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList>;
81
84
  runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList>;
82
85
  listTasks(component: Component): {
@@ -109,7 +112,7 @@ export declare class BuilderMain {
109
112
  static slots: ((registerFn: () => string) => SlotRegistry<BuildTask>)[];
110
113
  static runtime: import("@teambit/harmony").RuntimeDefinition;
111
114
  static dependencies: import("@teambit/harmony").Aspect[];
112
- static provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui]: [
115
+ static provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig]: [
113
116
  CLIMain,
114
117
  EnvsMain,
115
118
  Workspace,
@@ -120,6 +123,7 @@ export declare class BuilderMain {
120
123
  GraphqlMain,
121
124
  GeneratorMain,
122
125
  ComponentMain,
123
- UiMain
126
+ UiMain,
127
+ GlobalConfigMain
124
128
  ], config: any, [buildTaskSlot, tagTaskSlot, snapTaskSlot]: [TaskSlot, TaskSlot, TaskSlot]): Promise<BuilderMain>;
125
129
  }
@@ -72,6 +72,20 @@ function _harmony() {
72
72
  };
73
73
  return data;
74
74
  }
75
+ function _globalConfig() {
76
+ const data = _interopRequireDefault(require("@teambit/global-config"));
77
+ _globalConfig = function () {
78
+ return data;
79
+ };
80
+ return data;
81
+ }
82
+ function _constants() {
83
+ const data = require("@teambit/legacy/dist/constants");
84
+ _constants = function () {
85
+ return data;
86
+ };
87
+ return data;
88
+ }
75
89
  function _logger() {
76
90
  const data = require("@teambit/logger");
77
91
  _logger = function () {
@@ -228,7 +242,7 @@ const FILE_PATH_PARAM_DELIM = '~';
228
242
  */
229
243
  exports.FILE_PATH_PARAM_DELIM = FILE_PATH_PARAM_DELIM;
230
244
  class BuilderMain {
231
- constructor(envs, workspace, buildService, tagService, snapService, scope, isolator, aspectLoader, componentAspect, buildTaskSlot, tagTaskSlot, snapTaskSlot) {
245
+ constructor(envs, workspace, buildService, tagService, snapService, scope, isolator, aspectLoader, componentAspect, globalConfig, buildTaskSlot, tagTaskSlot, snapTaskSlot) {
232
246
  this.envs = envs;
233
247
  this.workspace = workspace;
234
248
  this.buildService = buildService;
@@ -238,6 +252,7 @@ class BuilderMain {
238
252
  this.isolator = isolator;
239
253
  this.aspectLoader = aspectLoader;
240
254
  this.componentAspect = componentAspect;
255
+ this.globalConfig = globalConfig;
241
256
  this.buildTaskSlot = buildTaskSlot;
242
257
  this.tagTaskSlot = tagTaskSlot;
243
258
  this.snapTaskSlot = snapTaskSlot;
@@ -421,15 +436,25 @@ class BuilderMain {
421
436
  }
422
437
  async build(components, isolateOptions, builderOptions) {
423
438
  const ids = components.map(c => c.id);
424
- const network = await this.isolator.isolateComponents(ids, isolateOptions, this.scope.legacyScope);
439
+ const capsulesBaseDir = this.getComponentsCapsulesBaseDir();
440
+ const baseIsolateOpts = {
441
+ baseDir: capsulesBaseDir,
442
+ useHash: !capsulesBaseDir
443
+ };
444
+ const mergedIsolateOpts = _objectSpread(_objectSpread({}, baseIsolateOpts), isolateOptions);
445
+ const network = await this.isolator.isolateComponents(ids, mergedIsolateOpts, this.scope.legacyScope);
425
446
  const envs = await this.envs.createEnvironment(network.graphCapsules.getAllComponents());
426
447
  const builderServiceOptions = _objectSpread({
427
448
  seedersOnly: isolateOptions === null || isolateOptions === void 0 ? void 0 : isolateOptions.seedersOnly,
428
- originalSeeders: ids
449
+ originalSeeders: ids,
450
+ capsulesBaseDir
429
451
  }, builderOptions || {});
430
452
  const buildResult = await envs.runOnce(this.buildService, builderServiceOptions);
431
453
  return buildResult;
432
454
  }
455
+ getComponentsCapsulesBaseDir() {
456
+ return this.globalConfig.getSync(_constants().CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);
457
+ }
433
458
  async runTagTasks(components, builderOptions) {
434
459
  const envs = await this.envs.createEnvironment(components);
435
460
  const buildResult = await envs.runOnce(this.tagService, builderOptions);
@@ -491,14 +516,14 @@ class BuilderMain {
491
516
  getDownloadUrlForArtifact(componentId, taskId, path) {
492
517
  return `/api/${componentId}/~aspect/builder/${taskId}/${path ? `${FILE_PATH_PARAM_DELIM}${path}` : ''}`;
493
518
  }
494
- static async provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui], config, [buildTaskSlot, tagTaskSlot, snapTaskSlot]) {
519
+ static async provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig], config, [buildTaskSlot, tagTaskSlot, snapTaskSlot]) {
495
520
  const artifactFactory = new (_artifactFactory().ArtifactFactory)();
496
521
  const logger = loggerExt.createLogger(_builder().BuilderAspect.id);
497
522
  const buildService = new (_builder3().BuilderService)(isolator, logger, buildTaskSlot, 'getBuildPipe', 'build', artifactFactory, scope);
498
523
  envs.registerService(buildService);
499
524
  const tagService = new (_builder3().BuilderService)(isolator, logger, tagTaskSlot, 'getTagPipe', 'tag', artifactFactory, scope);
500
525
  const snapService = new (_builder3().BuilderService)(isolator, logger, snapTaskSlot, 'getSnapPipe', 'snap', artifactFactory, scope);
501
- const builder = new BuilderMain(envs, workspace, buildService, tagService, snapService, scope, isolator, aspectLoader, component, buildTaskSlot, tagTaskSlot, snapTaskSlot);
526
+ const builder = new BuilderMain(envs, workspace, buildService, tagService, snapService, scope, isolator, aspectLoader, component, globalConfig, buildTaskSlot, tagTaskSlot, snapTaskSlot);
502
527
  builder.registerBuildTasks([new (_ui().BundleUiTask)(ui, logger)]);
503
528
  component.registerRoute([new (_builder4().BuilderRoute)(builder, scope, logger)]);
504
529
  graphql.register((0, _builder2().builderSchema)(builder, logger));
@@ -511,7 +536,7 @@ class BuilderMain {
511
536
  exports.BuilderMain = BuilderMain;
512
537
  (0, _defineProperty2().default)(BuilderMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
513
538
  (0, _defineProperty2().default)(BuilderMain, "runtime", _cli().MainRuntime);
514
- (0, _defineProperty2().default)(BuilderMain, "dependencies", [_cli().CLIAspect, _envs().EnvsAspect, _workspace().WorkspaceAspect, _scope().ScopeAspect, _isolator().IsolatorAspect, _logger().LoggerAspect, _aspectLoader().AspectLoaderAspect, _graphql().GraphqlAspect, _generator().GeneratorAspect, _component().ComponentAspect, _ui().UIAspect]);
539
+ (0, _defineProperty2().default)(BuilderMain, "dependencies", [_cli().CLIAspect, _envs().EnvsAspect, _workspace().WorkspaceAspect, _scope().ScopeAspect, _isolator().IsolatorAspect, _logger().LoggerAspect, _aspectLoader().AspectLoaderAspect, _graphql().GraphqlAspect, _generator().GeneratorAspect, _component().ComponentAspect, _ui().UIAspect, _globalConfig().default]);
515
540
  _builder().BuilderAspect.addRuntime(BuilderMain);
516
541
 
517
542
  //# sourceMappingURL=builder.main.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FILE_PATH_PARAM_DELIM","BuilderMain","constructor","envs","workspace","buildService","tagService","snapService","scope","isolator","aspectLoader","componentAspect","buildTaskSlot","tagTaskSlot","snapTaskSlot","storeArtifacts","tasksResults","artifacts","flatMap","t","storeP","map","artifactMap","Promise","all","toArray","component","artifactList","store","err","ArtifactStorageError","pipelineResultsToBuilderData","components","buildPipelineResults","buildPipelineResultList","BuildPipelineResultList","ComponentMap","as","aspectsData","getDataOfComponent","id","pipelineReport","getPipelineReportOfComponent","getArtifactsDataOfComponent","pipeline","bitVersion","getHarmonyVersion","tagListener","options","isolateOptions","builderOptions","pipeResults","allTasksResults","throwOnError","forceDeploy","disableTagAndSnapPipelines","isSnap","skipBuildPipeline","populateArtifactsFromParent","buildEnvsExecutionResults","build","emptyRootDir","tasks","AspectAspect","undefined","throwErrorsIfExist","push","hasErrors","builderOptionsForTagSnap","seedersOnly","previousTasksResults","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","combineBuildDataFromParent","validateBuilderDataMap","forEach","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","length","Error","toString","join","promises","builderData","idStr","parents","head","parent","parentComp","getHost","get","changeVersion","parentBuilderData","getBuilderData","artifact","artifactObj","toObject","find","a","task","aspectData","p","flattenValue","getArtifactsVinylByAspect","aspectName","getArtifactsByAspect","vinyls","getVinylsAndImportIfMissing","_legacy","legacyScope","getArtifactsVinylByAspectAndName","getArtifactsByAspectAndName","getArtifactsVinylByAspectAndTaskName","getArtifactsbyAspectAndTaskName","getArtifactsByName","getArtifacts","byAspectNameAndName","byAspectNameAndTaskName","getDataByAspect","data","ArtifactList","fromArray","BuilderAspect","clonedData","cloneDeep","artifactFiles","files","ArtifactFiles","fromObject","Artifact","Object","assign","fromArtifactObject","ids","c","network","isolateComponents","createEnvironment","graphCapsules","getAllComponents","builderServiceOptions","originalSeeders","buildResult","runOnce","listTasks","compEnv","getEnv","buildTasks","getCurrentPipeTasks","tagTasks","snapTasks","envId","registerBuildTasks","register","registerDeployTasks","registerTagTasks","registerSnapTasks","getDownloadUrlForArtifact","componentId","path","provider","cli","loggerExt","graphql","generator","ui","config","artifactFactory","ArtifactFactory","logger","createLogger","BuilderService","registerService","builder","BundleUiTask","registerRoute","BuilderRoute","builderSchema","registerComponentTemplate","buildTaskTemplate","commands","BuilderCmd","ArtifactsCmd","Slot","withType","MainRuntime","CLIAspect","EnvsAspect","WorkspaceAspect","ScopeAspect","IsolatorAspect","LoggerAspect","AspectLoaderAspect","GraphqlAspect","GeneratorAspect","ComponentAspect","UIAspect","addRuntime"],"sources":["builder.main.runtime.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\nimport { ArtifactFiles, ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentMap, IComponent, ComponentAspect, ComponentMain, ComponentID } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport AspectAspect from '@teambit/aspect';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { IsolateComponentsOptions, IsolatorAspect, IsolatorMain } from '@teambit/isolator';\nimport { getHarmonyVersion } from '@teambit/legacy/dist/bootstrap';\nimport findDuplications from '@teambit/legacy/dist/utils/array/find-duplications';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { UIAspect, UiMain, BundleUiTask } from '@teambit/ui';\nimport { Artifact, ArtifactList, FsArtifact } from './artifact';\nimport { ArtifactFactory } from './artifact/artifact-factory'; // it gets undefined when importing it from './artifact'\nimport { BuilderAspect } from './builder.aspect';\nimport { builderSchema } from './builder.graphql';\nimport { BuilderService, BuilderServiceOptions } from './builder.service';\nimport { BuilderCmd } from './build.cmd';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { ArtifactStorageError } from './exceptions';\nimport { BuildPipelineResultList, AspectData, PipelineReport } from './build-pipeline-result-list';\nimport { Serializable } from './types';\nimport { ArtifactsCmd } from './artifact/artifacts.cmd';\nimport { buildTaskTemplate } from './templates/build-task';\nimport { BuilderRoute } from './builder.route';\n\nexport type TaskSlot = SlotRegistry<BuildTask[]>;\nexport type OnTagResults = { builderDataMap: ComponentMap<RawBuilderData>; pipeResults: TaskResultsList[] };\nexport type OnTagOpts = {\n disableTagAndSnapPipelines?: boolean;\n throwOnError?: boolean; // on the CI it helps to save the results on failure so this is set to false\n forceDeploy?: boolean; // whether run the deploy-pipeline although the build-pipeline has failed\n skipBuildPipeline?: boolean; // helpful for tagging from scope where we want to use the build-artifacts of previous snap.\n combineBuildDataFromParent?: boolean; // helpful for tagging from scope where we want to save the build-data of parent snap.\n isSnap?: boolean;\n};\nexport const FILE_PATH_PARAM_DELIM = '~';\n\n/**\n * builder data format for the bit object store\n */\nexport type RawBuilderData = {\n pipeline: PipelineReport[];\n artifacts?: ArtifactObject[];\n aspectsData: AspectData[];\n bitVersion?: string;\n};\n/**\n * builder data mapped to an ArtifactList instance\n */\nexport type BuilderData = Omit<RawBuilderData, 'artifacts'> & {\n artifacts: ArtifactList<Artifact>;\n};\n\nexport class BuilderMain {\n constructor(\n private envs: EnvsMain,\n private workspace: Workspace,\n private buildService: BuilderService,\n private tagService: BuilderService,\n private snapService: BuilderService,\n private scope: ScopeMain,\n private isolator: IsolatorMain,\n private aspectLoader: AspectLoaderMain,\n private componentAspect: ComponentMain,\n private buildTaskSlot: TaskSlot,\n private tagTaskSlot: TaskSlot,\n private snapTaskSlot: TaskSlot\n ) {}\n\n private async storeArtifacts(tasksResults: TaskResults[]) {\n const artifacts = tasksResults.flatMap((t) => (t.artifacts ? [t.artifacts] : []));\n const storeP = artifacts.map(async (artifactMap: ComponentMap<ArtifactList<FsArtifact>>) => {\n return Promise.all(\n artifactMap.toArray().map(async ([component, artifactList]) => {\n try {\n return await artifactList.store(component);\n } catch (err: any) {\n throw new ArtifactStorageError(err, component);\n }\n })\n );\n });\n await Promise.all(storeP);\n }\n\n private pipelineResultsToBuilderData(\n components: Component[],\n buildPipelineResults: TaskResults[]\n ): ComponentMap<RawBuilderData> {\n const buildPipelineResultList = new BuildPipelineResultList(buildPipelineResults, components);\n return ComponentMap.as<RawBuilderData>(components, (component) => {\n const aspectsData = buildPipelineResultList.getDataOfComponent(component.id);\n const pipelineReport = buildPipelineResultList.getPipelineReportOfComponent(component.id);\n const artifacts = buildPipelineResultList.getArtifactsDataOfComponent(component.id);\n return { pipeline: pipelineReport, artifacts, aspectsData, bitVersion: getHarmonyVersion(true) };\n });\n }\n\n async tagListener(\n components: Component[],\n options: OnTagOpts = {},\n isolateOptions: IsolateComponentsOptions = {},\n builderOptions: BuilderServiceOptions = {}\n ): Promise<OnTagResults> {\n const pipeResults: TaskResultsList[] = [];\n const allTasksResults: TaskResults[] = [];\n const { throwOnError, forceDeploy, disableTagAndSnapPipelines, isSnap, skipBuildPipeline } = options;\n if (options.skipBuildPipeline) isolateOptions.populateArtifactsFromParent = true;\n const buildEnvsExecutionResults = await this.build(\n components,\n { emptyRootDir: true, ...isolateOptions },\n {\n ...builderOptions,\n // even when build is skipped (in case of tag-from-scope), the pre-build/post-build and teambit.harmony/aspect tasks are needed\n tasks: skipBuildPipeline ? [AspectAspect.id] : undefined,\n }\n );\n if (throwOnError && !forceDeploy) buildEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...buildEnvsExecutionResults.tasksResults);\n pipeResults.push(buildEnvsExecutionResults);\n\n if (forceDeploy || (!disableTagAndSnapPipelines && !buildEnvsExecutionResults?.hasErrors())) {\n const builderOptionsForTagSnap: BuilderServiceOptions = {\n ...builderOptions,\n seedersOnly: isolateOptions.seedersOnly,\n previousTasksResults: buildEnvsExecutionResults?.tasksResults,\n };\n const deployEnvsExecutionResults = isSnap\n ? await this.runSnapTasks(components, builderOptionsForTagSnap)\n : await this.runTagTasks(components, builderOptionsForTagSnap);\n if (throwOnError && !forceDeploy) deployEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...deployEnvsExecutionResults.tasksResults);\n pipeResults.push(deployEnvsExecutionResults);\n }\n await this.storeArtifacts(allTasksResults);\n const builderDataMap = this.pipelineResultsToBuilderData(components, allTasksResults);\n if (options.combineBuildDataFromParent) await this.combineBuildDataFromParent(builderDataMap);\n this.validateBuilderDataMap(builderDataMap);\n\n return { builderDataMap, pipeResults };\n }\n\n private validateBuilderDataMap(builderDataMap: ComponentMap<RawBuilderData>) {\n builderDataMap.forEach((buildData: RawBuilderData, component) => {\n const taskSerializedIds = buildData.pipeline.map((t) =>\n BuildTaskHelper.serializeId({ aspectId: t.taskId, name: t.taskName })\n );\n const duplications = findDuplications(taskSerializedIds);\n if (duplications.length) {\n throw new Error(\n `build-task-results validation has failed. the following task(s) of \"${component.id.toString()}\" are duplicated: ${duplications.join(\n ', '\n )}`\n );\n }\n });\n }\n\n private async combineBuildDataFromParent(builderDataMap: ComponentMap<RawBuilderData>) {\n const promises = builderDataMap.map(async (builderData, component) => {\n const idStr = component.id.toString();\n const parents = component.head?.parents;\n if (!parents || parents.length !== 1) {\n throw new Error(`expect parents of ${idStr} to be 1, got ${parents?.length || 'none'}`);\n }\n const parent = parents[0];\n const parentComp = await this.componentAspect.getHost().get(component.id.changeVersion(parent.toString()));\n if (!parentComp) throw new Error(`unable to load parent component of ${idStr}. hash: ${parent}`);\n const parentBuilderData = this.getBuilderData(parentComp);\n if (!parentBuilderData) throw new Error(`parent of ${idStr} was not built yet. unable to continue`);\n parentBuilderData.artifacts.forEach((artifact) => {\n const artifactObj = artifact.toObject();\n if (!builderData.artifacts) builderData.artifacts = [];\n if (\n builderData.artifacts.find((a) => a.task.id === artifactObj.task.id && a.task.name === artifactObj.task.name)\n ) {\n return;\n }\n builderData.artifacts.push(artifactObj);\n });\n parentBuilderData.aspectsData.forEach((aspectData) => {\n if (builderData.aspectsData.find((a) => a.aspectId === aspectData.aspectId)) return;\n builderData.aspectsData.push(aspectData);\n });\n parentBuilderData.pipeline.forEach((pipeline) => {\n if (builderData.pipeline.find((p) => p.taskId === pipeline.taskId && p.taskName === pipeline.taskName)) return;\n builderData.pipeline.push(pipeline);\n });\n });\n\n await Promise.all(promises.flattenValue());\n }\n\n // TODO: merge with getArtifactsVinylByExtensionAndName by getting aspect name and name as object with optional props\n async getArtifactsVinylByAspect(component: Component, aspectName: string): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspect(component, aspectName);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspectAndName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndTaskName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsbyAspectAndTaskName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n return vinyls;\n }\n\n getArtifactsByName(component: Component, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(undefined, name);\n return artifacts;\n }\n\n getArtifactsByAspect(component: Component, aspectName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName);\n return artifacts;\n }\n\n getArtifactsByAspectAndName(component: Component, aspectName: string, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName, name);\n return artifacts;\n }\n\n getArtifactsbyAspectAndTaskName(component: IComponent, aspectName: string, taskName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndTaskName(aspectName, taskName);\n return artifacts;\n }\n\n getDataByAspect(component: IComponent, aspectName: string): Serializable | undefined {\n const aspectsData = this.getBuilderData(component)?.aspectsData;\n const data = aspectsData?.find((aspectData) => aspectData.aspectId === aspectName);\n return data?.data;\n }\n\n getArtifacts(component: IComponent): ArtifactList<Artifact> {\n const artifacts = this.getBuilderData(component)?.artifacts || ArtifactList.fromArray([]);\n return artifacts;\n }\n\n getBuilderData(component: IComponent): BuilderData | undefined {\n const data = component.get(BuilderAspect.id)?.data;\n if (!data) return undefined;\n const clonedData = cloneDeep(data) as BuilderData;\n let artifactFiles: ArtifactFiles;\n const artifacts = clonedData.artifacts?.map((artifact) => {\n if (!(artifact.files instanceof ArtifactFiles)) {\n artifactFiles = ArtifactFiles.fromObject(artifact.files);\n } else {\n artifactFiles = artifact.files;\n }\n if (artifact instanceof Artifact) {\n return artifact;\n }\n Object.assign(artifact, { files: artifactFiles });\n return Artifact.fromArtifactObject(artifact);\n });\n clonedData.artifacts = ArtifactList.fromArray(artifacts || []);\n return clonedData;\n }\n\n async build(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n builderOptions?: BuilderServiceOptions\n ): Promise<TaskResultsList> {\n const ids = components.map((c) => c.id);\n const network = await this.isolator.isolateComponents(ids, isolateOptions, this.scope.legacyScope);\n const envs = await this.envs.createEnvironment(network.graphCapsules.getAllComponents());\n const builderServiceOptions = {\n seedersOnly: isolateOptions?.seedersOnly,\n originalSeeders: ids,\n ...(builderOptions || {}),\n };\n const buildResult = await envs.runOnce(this.buildService, builderServiceOptions);\n return buildResult;\n }\n\n async runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.tagService, builderOptions);\n\n return buildResult;\n }\n\n async runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.snapService, builderOptions);\n\n return buildResult;\n }\n\n listTasks(component: Component) {\n const compEnv = this.envs.getEnv(component);\n const buildTasks = this.buildService.getCurrentPipeTasks(compEnv);\n const tagTasks = this.tagService.getCurrentPipeTasks(compEnv);\n const snapTasks = this.snapService.getCurrentPipeTasks(compEnv);\n return { id: component.id, envId: compEnv.id, buildTasks, tagTasks, snapTasks };\n }\n\n /**\n * register a build task to apply on all component build pipelines.\n * build happens on `bit build` and as part of `bit tag --persist`.\n */\n registerBuildTasks(tasks: BuildTask[]) {\n this.buildTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * @deprecated use registerTagTasks or registerSnapTasks\n */\n registerDeployTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit tag'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerTagTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit snap'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerSnapTasks(tasks: BuildTask[]) {\n this.snapTaskSlot.register(tasks);\n return this;\n }\n\n getDownloadUrlForArtifact(componentId: ComponentID, taskId: string, path?: string) {\n return `/api/${componentId}/~aspect/builder/${taskId}/${path ? `${FILE_PATH_PARAM_DELIM}${path}` : ''}`;\n }\n\n static slots = [Slot.withType<BuildTask>(), Slot.withType<BuildTask>(), Slot.withType<BuildTask>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n EnvsAspect,\n WorkspaceAspect,\n ScopeAspect,\n IsolatorAspect,\n LoggerAspect,\n AspectLoaderAspect,\n GraphqlAspect,\n GeneratorAspect,\n ComponentAspect,\n UIAspect,\n ];\n\n static async provider(\n [cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui]: [\n CLIMain,\n EnvsMain,\n Workspace,\n ScopeMain,\n IsolatorMain,\n LoggerMain,\n AspectLoaderMain,\n GraphqlMain,\n GeneratorMain,\n ComponentMain,\n UiMain\n ],\n config,\n [buildTaskSlot, tagTaskSlot, snapTaskSlot]: [TaskSlot, TaskSlot, TaskSlot]\n ) {\n const artifactFactory = new ArtifactFactory();\n const logger = loggerExt.createLogger(BuilderAspect.id);\n const buildService = new BuilderService(\n isolator,\n logger,\n buildTaskSlot,\n 'getBuildPipe',\n 'build',\n artifactFactory,\n scope\n );\n envs.registerService(buildService);\n const tagService = new BuilderService(isolator, logger, tagTaskSlot, 'getTagPipe', 'tag', artifactFactory, scope);\n const snapService = new BuilderService(\n isolator,\n logger,\n snapTaskSlot,\n 'getSnapPipe',\n 'snap',\n artifactFactory,\n scope\n );\n const builder = new BuilderMain(\n envs,\n workspace,\n buildService,\n tagService,\n snapService,\n scope,\n isolator,\n aspectLoader,\n component,\n buildTaskSlot,\n tagTaskSlot,\n snapTaskSlot\n );\n builder.registerBuildTasks([new BundleUiTask(ui, logger)]);\n component.registerRoute([new BuilderRoute(builder, scope, logger)]);\n graphql.register(builderSchema(builder, logger));\n if (generator) generator.registerComponentTemplate([buildTaskTemplate]);\n const commands = [new BuilderCmd(builder, workspace, logger), new ArtifactsCmd(builder, component)];\n cli.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AK,EAAE2K,MAAM,CAAC,CAAC,CAAC;IACnEN,OAAO,CAACV,QAAQ,CAAC,IAAAwB,yBAAa,EAACJ,OAAO,EAAEJ,MAAM,CAAC,CAAC;IAChD,IAAIL,SAAS,EAAEA,SAAS,CAACc,yBAAyB,CAAC,CAACC,+BAAiB,CAAC,CAAC;IACvE,MAAMC,QAAQ,GAAG,CAAC,KAAIC,mBAAU,EAACR,OAAO,EAAEnL,SAAS,EAAE+K,MAAM,CAAC,EAAE,KAAIa,yBAAY,EAACT,OAAO,EAAE7J,SAAS,CAAC,CAAC;IACnGiJ,GAAG,CAACR,QAAQ,CAAC,GAAG2B,QAAQ,CAAC;IAEzB,OAAOP,OAAO;EAChB;AACF;AAAC;AAAA,gCAxXYtL,WAAW,WAySP,CAACgM,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAa,CAAC;AAAA,gCAzSxFjM,WAAW,aA2SLkM,kBAAW;AAAA,gCA3SjBlM,WAAW,kBA4SA,CACpBmM,gBAAS,EACTC,kBAAU,EACVC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,4BAAe,EACfC,4BAAe,EACfC,cAAQ,CACT;AAkEH1E,wBAAa,CAAC2E,UAAU,CAAC9M,WAAW,CAAC"}
1
+ {"version":3,"names":["FILE_PATH_PARAM_DELIM","BuilderMain","constructor","envs","workspace","buildService","tagService","snapService","scope","isolator","aspectLoader","componentAspect","globalConfig","buildTaskSlot","tagTaskSlot","snapTaskSlot","storeArtifacts","tasksResults","artifacts","flatMap","t","storeP","map","artifactMap","Promise","all","toArray","component","artifactList","store","err","ArtifactStorageError","pipelineResultsToBuilderData","components","buildPipelineResults","buildPipelineResultList","BuildPipelineResultList","ComponentMap","as","aspectsData","getDataOfComponent","id","pipelineReport","getPipelineReportOfComponent","getArtifactsDataOfComponent","pipeline","bitVersion","getHarmonyVersion","tagListener","options","isolateOptions","builderOptions","pipeResults","allTasksResults","throwOnError","forceDeploy","disableTagAndSnapPipelines","isSnap","skipBuildPipeline","populateArtifactsFromParent","buildEnvsExecutionResults","build","emptyRootDir","tasks","AspectAspect","undefined","throwErrorsIfExist","push","hasErrors","builderOptionsForTagSnap","seedersOnly","previousTasksResults","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","combineBuildDataFromParent","validateBuilderDataMap","forEach","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","length","Error","toString","join","promises","builderData","idStr","parents","head","parent","parentComp","getHost","get","changeVersion","parentBuilderData","getBuilderData","artifact","artifactObj","toObject","find","a","task","aspectData","p","flattenValue","getArtifactsVinylByAspect","aspectName","getArtifactsByAspect","vinyls","getVinylsAndImportIfMissing","_legacy","legacyScope","getArtifactsVinylByAspectAndName","getArtifactsByAspectAndName","getArtifactsVinylByAspectAndTaskName","getArtifactsbyAspectAndTaskName","getArtifactsByName","getArtifacts","byAspectNameAndName","byAspectNameAndTaskName","getDataByAspect","data","ArtifactList","fromArray","BuilderAspect","clonedData","cloneDeep","artifactFiles","files","ArtifactFiles","fromObject","Artifact","Object","assign","fromArtifactObject","ids","c","capsulesBaseDir","getComponentsCapsulesBaseDir","baseIsolateOpts","baseDir","useHash","mergedIsolateOpts","network","isolateComponents","createEnvironment","graphCapsules","getAllComponents","builderServiceOptions","originalSeeders","buildResult","runOnce","getSync","CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR","listTasks","compEnv","getEnv","buildTasks","getCurrentPipeTasks","tagTasks","snapTasks","envId","registerBuildTasks","register","registerDeployTasks","registerTagTasks","registerSnapTasks","getDownloadUrlForArtifact","componentId","path","provider","cli","loggerExt","graphql","generator","ui","config","artifactFactory","ArtifactFactory","logger","createLogger","BuilderService","registerService","builder","BundleUiTask","registerRoute","BuilderRoute","builderSchema","registerComponentTemplate","buildTaskTemplate","commands","BuilderCmd","ArtifactsCmd","Slot","withType","MainRuntime","CLIAspect","EnvsAspect","WorkspaceAspect","ScopeAspect","IsolatorAspect","LoggerAspect","AspectLoaderAspect","GraphqlAspect","GeneratorAspect","ComponentAspect","UIAspect","GlobalConfigAspect","addRuntime"],"sources":["builder.main.runtime.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\nimport { ArtifactFiles, ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentMap, IComponent, ComponentAspect, ComponentMain, ComponentID } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config';\nimport { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport AspectAspect from '@teambit/aspect';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { IsolateComponentsOptions, IsolatorAspect, IsolatorMain } from '@teambit/isolator';\nimport { getHarmonyVersion } from '@teambit/legacy/dist/bootstrap';\nimport findDuplications from '@teambit/legacy/dist/utils/array/find-duplications';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { UIAspect, UiMain, BundleUiTask } from '@teambit/ui';\nimport { Artifact, ArtifactList, FsArtifact } from './artifact';\nimport { ArtifactFactory } from './artifact/artifact-factory'; // it gets undefined when importing it from './artifact'\nimport { BuilderAspect } from './builder.aspect';\nimport { builderSchema } from './builder.graphql';\nimport { BuilderService, BuilderServiceOptions } from './builder.service';\nimport { BuilderCmd } from './build.cmd';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { ArtifactStorageError } from './exceptions';\nimport { BuildPipelineResultList, AspectData, PipelineReport } from './build-pipeline-result-list';\nimport { Serializable } from './types';\nimport { ArtifactsCmd } from './artifact/artifacts.cmd';\nimport { buildTaskTemplate } from './templates/build-task';\nimport { BuilderRoute } from './builder.route';\n\nexport type TaskSlot = SlotRegistry<BuildTask[]>;\nexport type OnTagResults = { builderDataMap: ComponentMap<RawBuilderData>; pipeResults: TaskResultsList[] };\nexport type OnTagOpts = {\n disableTagAndSnapPipelines?: boolean;\n throwOnError?: boolean; // on the CI it helps to save the results on failure so this is set to false\n forceDeploy?: boolean; // whether run the deploy-pipeline although the build-pipeline has failed\n skipBuildPipeline?: boolean; // helpful for tagging from scope where we want to use the build-artifacts of previous snap.\n combineBuildDataFromParent?: boolean; // helpful for tagging from scope where we want to save the build-data of parent snap.\n isSnap?: boolean;\n};\nexport const FILE_PATH_PARAM_DELIM = '~';\n\n/**\n * builder data format for the bit object store\n */\nexport type RawBuilderData = {\n pipeline: PipelineReport[];\n artifacts?: ArtifactObject[];\n aspectsData: AspectData[];\n bitVersion?: string;\n};\n/**\n * builder data mapped to an ArtifactList instance\n */\nexport type BuilderData = Omit<RawBuilderData, 'artifacts'> & {\n artifacts: ArtifactList<Artifact>;\n};\n\nexport class BuilderMain {\n constructor(\n private envs: EnvsMain,\n private workspace: Workspace,\n private buildService: BuilderService,\n private tagService: BuilderService,\n private snapService: BuilderService,\n private scope: ScopeMain,\n private isolator: IsolatorMain,\n private aspectLoader: AspectLoaderMain,\n private componentAspect: ComponentMain,\n private globalConfig: GlobalConfigMain,\n private buildTaskSlot: TaskSlot,\n private tagTaskSlot: TaskSlot,\n private snapTaskSlot: TaskSlot\n ) {}\n\n private async storeArtifacts(tasksResults: TaskResults[]) {\n const artifacts = tasksResults.flatMap((t) => (t.artifacts ? [t.artifacts] : []));\n const storeP = artifacts.map(async (artifactMap: ComponentMap<ArtifactList<FsArtifact>>) => {\n return Promise.all(\n artifactMap.toArray().map(async ([component, artifactList]) => {\n try {\n return await artifactList.store(component);\n } catch (err: any) {\n throw new ArtifactStorageError(err, component);\n }\n })\n );\n });\n await Promise.all(storeP);\n }\n\n private pipelineResultsToBuilderData(\n components: Component[],\n buildPipelineResults: TaskResults[]\n ): ComponentMap<RawBuilderData> {\n const buildPipelineResultList = new BuildPipelineResultList(buildPipelineResults, components);\n return ComponentMap.as<RawBuilderData>(components, (component) => {\n const aspectsData = buildPipelineResultList.getDataOfComponent(component.id);\n const pipelineReport = buildPipelineResultList.getPipelineReportOfComponent(component.id);\n const artifacts = buildPipelineResultList.getArtifactsDataOfComponent(component.id);\n return { pipeline: pipelineReport, artifacts, aspectsData, bitVersion: getHarmonyVersion(true) };\n });\n }\n\n async tagListener(\n components: Component[],\n options: OnTagOpts = {},\n isolateOptions: IsolateComponentsOptions = {},\n builderOptions: BuilderServiceOptions = {}\n ): Promise<OnTagResults> {\n const pipeResults: TaskResultsList[] = [];\n const allTasksResults: TaskResults[] = [];\n const { throwOnError, forceDeploy, disableTagAndSnapPipelines, isSnap, skipBuildPipeline } = options;\n if (options.skipBuildPipeline) isolateOptions.populateArtifactsFromParent = true;\n const buildEnvsExecutionResults = await this.build(\n components,\n { emptyRootDir: true, ...isolateOptions },\n {\n ...builderOptions,\n // even when build is skipped (in case of tag-from-scope), the pre-build/post-build and teambit.harmony/aspect tasks are needed\n tasks: skipBuildPipeline ? [AspectAspect.id] : undefined,\n }\n );\n if (throwOnError && !forceDeploy) buildEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...buildEnvsExecutionResults.tasksResults);\n pipeResults.push(buildEnvsExecutionResults);\n\n if (forceDeploy || (!disableTagAndSnapPipelines && !buildEnvsExecutionResults?.hasErrors())) {\n const builderOptionsForTagSnap: BuilderServiceOptions = {\n ...builderOptions,\n seedersOnly: isolateOptions.seedersOnly,\n previousTasksResults: buildEnvsExecutionResults?.tasksResults,\n };\n const deployEnvsExecutionResults = isSnap\n ? await this.runSnapTasks(components, builderOptionsForTagSnap)\n : await this.runTagTasks(components, builderOptionsForTagSnap);\n if (throwOnError && !forceDeploy) deployEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...deployEnvsExecutionResults.tasksResults);\n pipeResults.push(deployEnvsExecutionResults);\n }\n await this.storeArtifacts(allTasksResults);\n const builderDataMap = this.pipelineResultsToBuilderData(components, allTasksResults);\n if (options.combineBuildDataFromParent) await this.combineBuildDataFromParent(builderDataMap);\n this.validateBuilderDataMap(builderDataMap);\n\n return { builderDataMap, pipeResults };\n }\n\n private validateBuilderDataMap(builderDataMap: ComponentMap<RawBuilderData>) {\n builderDataMap.forEach((buildData: RawBuilderData, component) => {\n const taskSerializedIds = buildData.pipeline.map((t) =>\n BuildTaskHelper.serializeId({ aspectId: t.taskId, name: t.taskName })\n );\n const duplications = findDuplications(taskSerializedIds);\n if (duplications.length) {\n throw new Error(\n `build-task-results validation has failed. the following task(s) of \"${component.id.toString()}\" are duplicated: ${duplications.join(\n ', '\n )}`\n );\n }\n });\n }\n\n private async combineBuildDataFromParent(builderDataMap: ComponentMap<RawBuilderData>) {\n const promises = builderDataMap.map(async (builderData, component) => {\n const idStr = component.id.toString();\n const parents = component.head?.parents;\n if (!parents || parents.length !== 1) {\n throw new Error(`expect parents of ${idStr} to be 1, got ${parents?.length || 'none'}`);\n }\n const parent = parents[0];\n const parentComp = await this.componentAspect.getHost().get(component.id.changeVersion(parent.toString()));\n if (!parentComp) throw new Error(`unable to load parent component of ${idStr}. hash: ${parent}`);\n const parentBuilderData = this.getBuilderData(parentComp);\n if (!parentBuilderData) throw new Error(`parent of ${idStr} was not built yet. unable to continue`);\n parentBuilderData.artifacts.forEach((artifact) => {\n const artifactObj = artifact.toObject();\n if (!builderData.artifacts) builderData.artifacts = [];\n if (\n builderData.artifacts.find((a) => a.task.id === artifactObj.task.id && a.task.name === artifactObj.task.name)\n ) {\n return;\n }\n builderData.artifacts.push(artifactObj);\n });\n parentBuilderData.aspectsData.forEach((aspectData) => {\n if (builderData.aspectsData.find((a) => a.aspectId === aspectData.aspectId)) return;\n builderData.aspectsData.push(aspectData);\n });\n parentBuilderData.pipeline.forEach((pipeline) => {\n if (builderData.pipeline.find((p) => p.taskId === pipeline.taskId && p.taskName === pipeline.taskName)) return;\n builderData.pipeline.push(pipeline);\n });\n });\n\n await Promise.all(promises.flattenValue());\n }\n\n // TODO: merge with getArtifactsVinylByExtensionAndName by getting aspect name and name as object with optional props\n async getArtifactsVinylByAspect(component: Component, aspectName: string): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspect(component, aspectName);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspectAndName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndTaskName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsbyAspectAndTaskName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n return vinyls;\n }\n\n getArtifactsByName(component: Component, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(undefined, name);\n return artifacts;\n }\n\n getArtifactsByAspect(component: Component, aspectName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName);\n return artifacts;\n }\n\n getArtifactsByAspectAndName(component: Component, aspectName: string, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName, name);\n return artifacts;\n }\n\n getArtifactsbyAspectAndTaskName(component: IComponent, aspectName: string, taskName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndTaskName(aspectName, taskName);\n return artifacts;\n }\n\n getDataByAspect(component: IComponent, aspectName: string): Serializable | undefined {\n const aspectsData = this.getBuilderData(component)?.aspectsData;\n const data = aspectsData?.find((aspectData) => aspectData.aspectId === aspectName);\n return data?.data;\n }\n\n getArtifacts(component: IComponent): ArtifactList<Artifact> {\n const artifacts = this.getBuilderData(component)?.artifacts || ArtifactList.fromArray([]);\n return artifacts;\n }\n\n getBuilderData(component: IComponent): BuilderData | undefined {\n const data = component.get(BuilderAspect.id)?.data;\n if (!data) return undefined;\n const clonedData = cloneDeep(data) as BuilderData;\n let artifactFiles: ArtifactFiles;\n const artifacts = clonedData.artifacts?.map((artifact) => {\n if (!(artifact.files instanceof ArtifactFiles)) {\n artifactFiles = ArtifactFiles.fromObject(artifact.files);\n } else {\n artifactFiles = artifact.files;\n }\n if (artifact instanceof Artifact) {\n return artifact;\n }\n Object.assign(artifact, { files: artifactFiles });\n return Artifact.fromArtifactObject(artifact);\n });\n clonedData.artifacts = ArtifactList.fromArray(artifacts || []);\n return clonedData;\n }\n\n async build(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n builderOptions?: BuilderServiceOptions\n ): Promise<TaskResultsList> {\n const ids = components.map((c) => c.id);\n const capsulesBaseDir = this.getComponentsCapsulesBaseDir();\n const baseIsolateOpts = {\n baseDir: capsulesBaseDir,\n useHash: !capsulesBaseDir,\n };\n const mergedIsolateOpts = {\n ...baseIsolateOpts,\n ...isolateOptions,\n };\n\n const network = await this.isolator.isolateComponents(ids, mergedIsolateOpts, this.scope.legacyScope);\n const envs = await this.envs.createEnvironment(network.graphCapsules.getAllComponents());\n const builderServiceOptions = {\n seedersOnly: isolateOptions?.seedersOnly,\n originalSeeders: ids,\n capsulesBaseDir,\n ...(builderOptions || {}),\n };\n const buildResult = await envs.runOnce(this.buildService, builderServiceOptions);\n return buildResult;\n }\n\n getComponentsCapsulesBaseDir(): string | undefined {\n return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);\n }\n\n async runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.tagService, builderOptions);\n\n return buildResult;\n }\n\n async runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.snapService, builderOptions);\n\n return buildResult;\n }\n\n listTasks(component: Component) {\n const compEnv = this.envs.getEnv(component);\n const buildTasks = this.buildService.getCurrentPipeTasks(compEnv);\n const tagTasks = this.tagService.getCurrentPipeTasks(compEnv);\n const snapTasks = this.snapService.getCurrentPipeTasks(compEnv);\n return { id: component.id, envId: compEnv.id, buildTasks, tagTasks, snapTasks };\n }\n\n /**\n * register a build task to apply on all component build pipelines.\n * build happens on `bit build` and as part of `bit tag --persist`.\n */\n registerBuildTasks(tasks: BuildTask[]) {\n this.buildTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * @deprecated use registerTagTasks or registerSnapTasks\n */\n registerDeployTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit tag'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerTagTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit snap'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerSnapTasks(tasks: BuildTask[]) {\n this.snapTaskSlot.register(tasks);\n return this;\n }\n\n getDownloadUrlForArtifact(componentId: ComponentID, taskId: string, path?: string) {\n return `/api/${componentId}/~aspect/builder/${taskId}/${path ? `${FILE_PATH_PARAM_DELIM}${path}` : ''}`;\n }\n\n static slots = [Slot.withType<BuildTask>(), Slot.withType<BuildTask>(), Slot.withType<BuildTask>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n EnvsAspect,\n WorkspaceAspect,\n ScopeAspect,\n IsolatorAspect,\n LoggerAspect,\n AspectLoaderAspect,\n GraphqlAspect,\n GeneratorAspect,\n ComponentAspect,\n UIAspect,\n GlobalConfigAspect,\n ];\n\n static async provider(\n [cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig]: [\n CLIMain,\n EnvsMain,\n Workspace,\n ScopeMain,\n IsolatorMain,\n LoggerMain,\n AspectLoaderMain,\n GraphqlMain,\n GeneratorMain,\n ComponentMain,\n UiMain,\n GlobalConfigMain\n ],\n config,\n [buildTaskSlot, tagTaskSlot, snapTaskSlot]: [TaskSlot, TaskSlot, TaskSlot]\n ) {\n const artifactFactory = new ArtifactFactory();\n const logger = loggerExt.createLogger(BuilderAspect.id);\n const buildService = new BuilderService(\n isolator,\n logger,\n buildTaskSlot,\n 'getBuildPipe',\n 'build',\n artifactFactory,\n scope\n );\n envs.registerService(buildService);\n const tagService = new BuilderService(isolator, logger, tagTaskSlot, 'getTagPipe', 'tag', artifactFactory, scope);\n const snapService = new BuilderService(\n isolator,\n logger,\n snapTaskSlot,\n 'getSnapPipe',\n 'snap',\n artifactFactory,\n scope\n );\n const builder = new BuilderMain(\n envs,\n workspace,\n buildService,\n tagService,\n snapService,\n scope,\n isolator,\n aspectLoader,\n component,\n globalConfig,\n buildTaskSlot,\n tagTaskSlot,\n snapTaskSlot\n );\n builder.registerBuildTasks([new BundleUiTask(ui, logger)]);\n component.registerRoute([new BuilderRoute(builder, scope, logger)]);\n graphql.register(builderSchema(builder, logger));\n if (generator) generator.registerComponentTemplate([buildTaskTemplate]);\n const commands = [new BuilderCmd(builder, workspace, logger), new ArtifactsCmd(builder, component)];\n cli.register(...commands);\n\n return builder;\n }\n}\n\nBuilderAspect.addRuntime(BuilderMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA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C"}
@@ -23,6 +23,7 @@ export declare type BuilderServiceOptions = {
23
23
  previousTasksResults?: TaskResults[];
24
24
  dev?: boolean;
25
25
  exitOnFirstFailedTask?: boolean;
26
+ capsulesBaseDir?: string;
26
27
  };
27
28
  declare type BuilderTransformationMap = ServiceTransformationMap & {
28
29
  getBuildPipe: () => BuildTask[];
@@ -111,16 +111,19 @@ class BuilderService {
111
111
  const longProcessLogger = this.logger.createLongProcessLogger(title);
112
112
  this.logger.consoleTitle(title);
113
113
  const envsBuildContext = {};
114
+ const isolateOpts = {
115
+ baseDir: options.capsulesBaseDir,
116
+ useHash: !options.capsulesBaseDir,
117
+ getExistingAsIs: true,
118
+ seedersOnly: options.seedersOnly
119
+ };
114
120
  await (0, _pMapSeries().default)(envsExecutionContext, async executionContext => {
115
121
  const componentIds = executionContext.components.map(component => component.id);
116
122
  const {
117
123
  originalSeeders
118
124
  } = options;
119
125
  const originalSeedersOfThisEnv = componentIds.filter(compId => originalSeeders ? originalSeeders.find(seeder => compId.isEqual(seeder)) : true);
120
- const capsuleNetwork = await this.isolator.isolateComponents(componentIds, {
121
- getExistingAsIs: true,
122
- seedersOnly: options.seedersOnly
123
- });
126
+ const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOpts);
124
127
  capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;
125
128
  this.logger.console(`generated graph for env "${executionContext.id}", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`);
126
129
  const buildContext = Object.assign(executionContext, {
@@ -1 +1 @@
1
- {"version":3,"names":["pipeNames","getBuildPipe","getTagPipe","getSnapPipe","BuilderService","constructor","isolator","logger","taskSlot","pipeNameOnEnv","displayPipeName","artifactFactory","scope","runOnce","envsExecutionContext","options","envs","map","executionContext","envDefinition","tasksQueue","calculatePipelineOrder","tasks","skipTests","validate","info","toString","title","length","longProcessLogger","createLongProcessLogger","consoleTitle","envsBuildContext","pMapSeries","componentIds","components","component","id","originalSeeders","originalSeedersOfThisEnv","filter","compId","find","seeder","isEqual","capsuleNetwork","isolateComponents","getExistingAsIs","seedersOnly","_originalSeeders","console","seedersCapsules","graphCapsules","buildContext","Object","assign","previousTasksResults","pipeName","dev","laneId","legacyScope","currentLaneId","buildPipe","BuildPipe","exitOnFirstFailedTask","buildResults","execute","end","hasErrors","consoleFailure","consoleSuccess","render","env","pipes","getDescriptor","BuilderAspect","renderOnePipe","transform","envContext","build","undefined","pipeline","compute","tag","snap","task","index","keys","pipeFuncName","getTasksNamesByPipeFunc","BuildTaskHelper","serializeId","getCurrentPipeTasks"],"sources":["builder.service.tsx"],"sourcesContent":["import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport React from 'react';\nimport { ScopeMain } from '@teambit/scope';\nimport pMapSeries from 'p-map-series';\nimport { Text, Newline } from 'ink';\nimport { Logger } from '@teambit/logger';\nimport { IsolatorMain } from '@teambit/isolator';\nimport { Component, ComponentID } from '@teambit/component';\nimport { BuildPipe, TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskSlot } from './builder.main.runtime';\nimport { BuildContext, BuildTask, BuildTaskHelper } from './build-task';\nimport { ArtifactFactory } from './artifact';\nimport { calculatePipelineOrder } from './build-pipeline-order';\nimport { BuilderAspect } from './builder.aspect';\n\nexport type BuildServiceResults = {\n id: string;\n buildResults: TaskResultsList;\n components: Component[];\n errors?: [];\n};\n\nexport type BuilderServiceOptions = {\n seedersOnly?: boolean;\n originalSeeders?: ComponentID[];\n tasks?: string[];\n skipTests?: boolean;\n previousTasksResults?: TaskResults[];\n dev?: boolean;\n exitOnFirstFailedTask?: boolean;\n};\n\ntype BuilderTransformationMap = ServiceTransformationMap & {\n getBuildPipe: () => BuildTask[];\n getTagPipe: () => BuildTask[];\n getSnapPipe: () => BuildTask[];\n};\n\nexport type EnvsBuildContext = { [envId: string]: BuildContext };\n\nconst pipeNames = {\n getBuildPipe: 'build',\n getTagPipe: 'tag',\n getSnapPipe: 'snap',\n};\n\nexport type PipeName = 'build' | 'tag' | 'snap';\n\nexport type BuilderDescriptor = Array<{ pipeName: PipeName; tasks: string[] }>;\n\ntype PipeFunctionNames = keyof typeof pipeNames;\nexport class BuilderService implements EnvService<BuildServiceResults, BuilderDescriptor> {\n name = 'builder';\n\n constructor(\n /**\n * isolator extension.\n */\n private isolator: IsolatorMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * task slot (e.g tasks registered by other extensions.).\n */\n private taskSlot: TaskSlot,\n\n /**\n * a method with such name should be implemented on the env in order to run the pipe tasks.\n */\n private pipeNameOnEnv: PipeFunctionNames,\n\n /**\n * pipe name to display on the console during the execution\n */\n private displayPipeName: PipeName,\n private artifactFactory: ArtifactFactory,\n private scope: ScopeMain\n ) {}\n\n /**\n * runs all tasks for all envs\n */\n async runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = envsExecutionContext.map((executionContext) => executionContext.envDefinition);\n const tasksQueue = calculatePipelineOrder(\n this.taskSlot,\n envs,\n this.pipeNameOnEnv,\n options.tasks,\n options.skipTests\n );\n tasksQueue.validate();\n this.logger.info(`going to run tasks in the following order:\\n${tasksQueue.toString()}`);\n const title = `running ${this.displayPipeName} pipe for ${envs.length} environments, total ${tasksQueue.length} tasks`;\n const longProcessLogger = this.logger.createLongProcessLogger(title);\n this.logger.consoleTitle(title);\n const envsBuildContext: EnvsBuildContext = {};\n await pMapSeries(envsExecutionContext, async (executionContext) => {\n const componentIds = executionContext.components.map((component) => component.id);\n const { originalSeeders } = options;\n const originalSeedersOfThisEnv = componentIds.filter((compId) =>\n originalSeeders ? originalSeeders.find((seeder) => compId.isEqual(seeder)) : true\n );\n const capsuleNetwork = await this.isolator.isolateComponents(componentIds, {\n getExistingAsIs: true,\n seedersOnly: options.seedersOnly,\n });\n capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;\n this.logger.console(\n `generated graph for env \"${executionContext.id}\", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`\n );\n const buildContext = Object.assign(executionContext, {\n capsuleNetwork,\n previousTasksResults: [],\n pipeName: this.displayPipeName,\n dev: options.dev,\n laneId: this.scope.legacyScope.currentLaneId,\n });\n envsBuildContext[executionContext.id] = buildContext;\n });\n const buildPipe = new BuildPipe(\n tasksQueue,\n envsBuildContext,\n this.logger,\n this.artifactFactory,\n options.previousTasksResults,\n { exitOnFirstFailedTask: options.exitOnFirstFailedTask }\n );\n const buildResults = await buildPipe.execute();\n longProcessLogger.end();\n buildResults.hasErrors() ? this.logger.consoleFailure() : this.logger.consoleSuccess();\n\n return buildResults;\n }\n\n render(env: EnvDefinition) {\n const pipes = this.getDescriptor(env);\n\n return (\n <Text key={BuilderAspect.id}>{pipes.map(({ pipeName, tasks }) => this.renderOnePipe(pipeName, tasks))}</Text>\n );\n }\n\n transform(env: Env, envContext: EnvContext): BuilderTransformationMap | undefined {\n if (!env?.build) return undefined;\n return {\n getBuildPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.build();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getTagPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.tag();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getSnapPipe: () => {\n const pipeline = env.snap();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n };\n }\n\n private renderOnePipe(pipeName, tasks) {\n if (!tasks || !tasks.length) return null;\n return (\n <Text key={pipeName}>\n <Text underline color=\"green\">\n {pipeName} pipe\n </Text>\n <Newline />\n <Text color=\"cyan\">total {tasks.length} tasks are configured to be executed in the following order</Text>\n <Newline />\n {tasks.map((task, index) => (\n <Text key={index}>\n <Text>\n {index + 1}. {task}\n </Text>\n <Newline />\n </Text>\n ))}\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n // @ts-ignore\n const tasks = Object.keys(pipeNames).map((pipeFuncName: PipeFunctionNames) => {\n const tasksQueue = this.getTasksNamesByPipeFunc(env, pipeFuncName);\n return { pipeName: pipeNames[pipeFuncName], tasks: tasksQueue };\n });\n return tasks as BuilderDescriptor;\n }\n\n private getTasksNamesByPipeFunc(env: EnvDefinition, pipeFuncName: PipeFunctionNames): string[] {\n const tasksQueue = calculatePipelineOrder(this.taskSlot, [env], pipeFuncName).map(({ task }) =>\n BuildTaskHelper.serializeId(task)\n );\n return tasksQueue;\n }\n\n getCurrentPipeTasks(env: EnvDefinition) {\n return this.getTasksNamesByPipeFunc(env, this.pipeNameOnEnv);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AA2BA,MAAMA,SAAS,GAAG;EAChBC,YAAY,EAAE,OAAO;EACrBC,UAAU,EAAE,KAAK;EACjBC,WAAW,EAAE;AACf,CAAC;AAOM,MAAMC,cAAc,CAA+D;EAGxFC,WAAW;EACT;AACJ;AACA;EACYC,QAAsB;EAE9B;AACJ;AACA;EACYC,MAAc;EAEtB;AACJ;AACA;EACYC,QAAkB;EAE1B;AACJ;AACA;EACYC,aAAgC;EAExC;AACJ;AACA;EACYC,eAAyB,EACzBC,eAAgC,EAChCC,KAAgB,EACxB;IAAA,KAvBQN,QAAsB,GAAtBA,QAAsB;IAAA,KAKtBC,MAAc,GAAdA,MAAc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AACb,QAAQ,EAAE,CAACgE,GAAG,CAAC,EAAEgB,YAAY,CAAC,CAACvE,GAAG,CAAC,CAAC;MAAEoE;IAAK,CAAC,KACzFK,4BAAe,CAACC,WAAW,CAACN,IAAI,CAAC,CAClC;IACD,OAAOjE,UAAU;EACnB;EAEAwE,mBAAmB,CAACpB,GAAkB,EAAE;IACtC,OAAO,IAAI,CAACiB,uBAAuB,CAACjB,GAAG,EAAE,IAAI,CAAC/D,aAAa,CAAC;EAC9D;AACF;AAAC"}
1
+ {"version":3,"names":["pipeNames","getBuildPipe","getTagPipe","getSnapPipe","BuilderService","constructor","isolator","logger","taskSlot","pipeNameOnEnv","displayPipeName","artifactFactory","scope","runOnce","envsExecutionContext","options","envs","map","executionContext","envDefinition","tasksQueue","calculatePipelineOrder","tasks","skipTests","validate","info","toString","title","length","longProcessLogger","createLongProcessLogger","consoleTitle","envsBuildContext","isolateOpts","baseDir","capsulesBaseDir","useHash","getExistingAsIs","seedersOnly","pMapSeries","componentIds","components","component","id","originalSeeders","originalSeedersOfThisEnv","filter","compId","find","seeder","isEqual","capsuleNetwork","isolateComponents","_originalSeeders","console","seedersCapsules","graphCapsules","buildContext","Object","assign","previousTasksResults","pipeName","dev","laneId","legacyScope","currentLaneId","buildPipe","BuildPipe","exitOnFirstFailedTask","buildResults","execute","end","hasErrors","consoleFailure","consoleSuccess","render","env","pipes","getDescriptor","BuilderAspect","renderOnePipe","transform","envContext","build","undefined","pipeline","compute","tag","snap","task","index","keys","pipeFuncName","getTasksNamesByPipeFunc","BuildTaskHelper","serializeId","getCurrentPipeTasks"],"sources":["builder.service.tsx"],"sourcesContent":["import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport React from 'react';\nimport { ScopeMain } from '@teambit/scope';\nimport pMapSeries from 'p-map-series';\nimport { Text, Newline } from 'ink';\nimport { Logger } from '@teambit/logger';\nimport { IsolatorMain } from '@teambit/isolator';\nimport { Component, ComponentID } from '@teambit/component';\nimport { BuildPipe, TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskSlot } from './builder.main.runtime';\nimport { BuildContext, BuildTask, BuildTaskHelper } from './build-task';\nimport { ArtifactFactory } from './artifact';\nimport { calculatePipelineOrder } from './build-pipeline-order';\nimport { BuilderAspect } from './builder.aspect';\n\nexport type BuildServiceResults = {\n id: string;\n buildResults: TaskResultsList;\n components: Component[];\n errors?: [];\n};\n\nexport type BuilderServiceOptions = {\n seedersOnly?: boolean;\n originalSeeders?: ComponentID[];\n tasks?: string[];\n skipTests?: boolean;\n previousTasksResults?: TaskResults[];\n dev?: boolean;\n exitOnFirstFailedTask?: boolean;\n capsulesBaseDir?: string;\n};\n\ntype BuilderTransformationMap = ServiceTransformationMap & {\n getBuildPipe: () => BuildTask[];\n getTagPipe: () => BuildTask[];\n getSnapPipe: () => BuildTask[];\n};\n\nexport type EnvsBuildContext = { [envId: string]: BuildContext };\n\nconst pipeNames = {\n getBuildPipe: 'build',\n getTagPipe: 'tag',\n getSnapPipe: 'snap',\n};\n\nexport type PipeName = 'build' | 'tag' | 'snap';\n\nexport type BuilderDescriptor = Array<{ pipeName: PipeName; tasks: string[] }>;\n\ntype PipeFunctionNames = keyof typeof pipeNames;\nexport class BuilderService implements EnvService<BuildServiceResults, BuilderDescriptor> {\n name = 'builder';\n\n constructor(\n /**\n * isolator extension.\n */\n private isolator: IsolatorMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * task slot (e.g tasks registered by other extensions.).\n */\n private taskSlot: TaskSlot,\n\n /**\n * a method with such name should be implemented on the env in order to run the pipe tasks.\n */\n private pipeNameOnEnv: PipeFunctionNames,\n\n /**\n * pipe name to display on the console during the execution\n */\n private displayPipeName: PipeName,\n private artifactFactory: ArtifactFactory,\n private scope: ScopeMain\n ) {}\n\n /**\n * runs all tasks for all envs\n */\n async runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = envsExecutionContext.map((executionContext) => executionContext.envDefinition);\n const tasksQueue = calculatePipelineOrder(\n this.taskSlot,\n envs,\n this.pipeNameOnEnv,\n options.tasks,\n options.skipTests\n );\n tasksQueue.validate();\n this.logger.info(`going to run tasks in the following order:\\n${tasksQueue.toString()}`);\n const title = `running ${this.displayPipeName} pipe for ${envs.length} environments, total ${tasksQueue.length} tasks`;\n const longProcessLogger = this.logger.createLongProcessLogger(title);\n this.logger.consoleTitle(title);\n const envsBuildContext: EnvsBuildContext = {};\n const isolateOpts = {\n baseDir: options.capsulesBaseDir,\n useHash: !options.capsulesBaseDir,\n getExistingAsIs: true,\n seedersOnly: options.seedersOnly,\n };\n await pMapSeries(envsExecutionContext, async (executionContext) => {\n const componentIds = executionContext.components.map((component) => component.id);\n const { originalSeeders } = options;\n const originalSeedersOfThisEnv = componentIds.filter((compId) =>\n originalSeeders ? originalSeeders.find((seeder) => compId.isEqual(seeder)) : true\n );\n const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOpts);\n capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;\n this.logger.console(\n `generated graph for env \"${executionContext.id}\", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`\n );\n const buildContext = Object.assign(executionContext, {\n capsuleNetwork,\n previousTasksResults: [],\n pipeName: this.displayPipeName,\n dev: options.dev,\n laneId: this.scope.legacyScope.currentLaneId,\n });\n envsBuildContext[executionContext.id] = buildContext;\n });\n const buildPipe = new BuildPipe(\n tasksQueue,\n envsBuildContext,\n this.logger,\n this.artifactFactory,\n options.previousTasksResults,\n { exitOnFirstFailedTask: options.exitOnFirstFailedTask }\n );\n const buildResults = await buildPipe.execute();\n longProcessLogger.end();\n buildResults.hasErrors() ? this.logger.consoleFailure() : this.logger.consoleSuccess();\n\n return buildResults;\n }\n\n render(env: EnvDefinition) {\n const pipes = this.getDescriptor(env);\n\n return (\n <Text key={BuilderAspect.id}>{pipes.map(({ pipeName, tasks }) => this.renderOnePipe(pipeName, tasks))}</Text>\n );\n }\n\n transform(env: Env, envContext: EnvContext): BuilderTransformationMap | undefined {\n if (!env?.build) return undefined;\n return {\n getBuildPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.build();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getTagPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.tag();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getSnapPipe: () => {\n const pipeline = env.snap();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n };\n }\n\n private renderOnePipe(pipeName, tasks) {\n if (!tasks || !tasks.length) return null;\n return (\n <Text key={pipeName}>\n <Text underline color=\"green\">\n {pipeName} pipe\n </Text>\n <Newline />\n <Text color=\"cyan\">total {tasks.length} tasks are configured to be executed in the following order</Text>\n <Newline />\n {tasks.map((task, index) => (\n <Text key={index}>\n <Text>\n {index + 1}. {task}\n </Text>\n <Newline />\n </Text>\n ))}\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n // @ts-ignore\n const tasks = Object.keys(pipeNames).map((pipeFuncName: PipeFunctionNames) => {\n const tasksQueue = this.getTasksNamesByPipeFunc(env, pipeFuncName);\n return { pipeName: pipeNames[pipeFuncName], tasks: tasksQueue };\n });\n return tasks as BuilderDescriptor;\n }\n\n private getTasksNamesByPipeFunc(env: EnvDefinition, pipeFuncName: PipeFunctionNames): string[] {\n const tasksQueue = calculatePipelineOrder(this.taskSlot, [env], pipeFuncName).map(({ task }) =>\n BuildTaskHelper.serializeId(task)\n );\n return tasksQueue;\n }\n\n getCurrentPipeTasks(env: EnvDefinition) {\n return this.getTasksNamesByPipeFunc(env, this.pipeNameOnEnv);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;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KAAK,CAACM,MAAM,EAAC,6DAA2D,CAAO,eACzG,+BAAC,cAAO,OAAG,EACVN,KAAK,CAACL,GAAG,CAAC,CAACwE,IAAI,EAAEC,KAAK,kBACrB,+BAAC,WAAI;MAAC,GAAG,EAAEA;IAAM,gBACf,+BAAC,WAAI,QACFA,KAAK,GAAG,CAAC,EAAC,IAAE,EAACD,IAAI,CACb,eACP,+BAAC,cAAO,OAAG,CAEd,CAAC,eACF,+BAAC,cAAO,OAAG,CACN;EAEX;EAEAX,aAAa,CAACF,GAAkB,EAAE;IAChC;IACA,MAAMtD,KAAK,GAAGoC,MAAM,CAACiC,IAAI,CAAC3F,SAAS,CAAC,CAACiB,GAAG,CAAE2E,YAA+B,IAAK;MAC5E,MAAMxE,UAAU,GAAG,IAAI,CAACyE,uBAAuB,CAACjB,GAAG,EAAEgB,YAAY,CAAC;MAClE,OAAO;QAAE/B,QAAQ,EAAE7D,SAAS,CAAC4F,YAAY,CAAC;QAAEtE,KAAK,EAAEF;MAAW,CAAC;IACjE,CAAC,CAAC;IACF,OAAOE,KAAK;EACd;EAEQuE,uBAAuB,CAACjB,GAAkB,EAAEgB,YAA+B,EAAY;IAC7F,MAAMxE,UAAU,GAAG,IAAAC,4CAAsB,EAAC,IAAI,CAACb,QAAQ,EAAE,CAACoE,GAAG,CAAC,EAAEgB,YAAY,CAAC,CAAC3E,GAAG,CAAC,CAAC;MAAEwE;IAAK,CAAC,KACzFK,4BAAe,CAACC,WAAW,CAACN,IAAI,CAAC,CAClC;IACD,OAAOrE,UAAU;EACnB;EAEA4E,mBAAmB,CAACpB,GAAkB,EAAE;IACtC,OAAO,IAAI,CAACiB,uBAAuB,CAACjB,GAAG,EAAE,IAAI,CAACnE,aAAa,CAAC;EAC9D;AACF;AAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1083/dist/builder.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1083/dist/builder.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1085/dist/builder.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1085/dist/builder.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/builder",
3
- "version": "0.0.1083",
3
+ "version": "0.0.1085",
4
4
  "homepage": "https://bit.cloud/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.1083"
9
+ "version": "0.0.1085"
10
10
  },
11
11
  "dependencies": {
12
12
  "p-map-series": "2.1.0",
@@ -27,21 +27,22 @@
27
27
  "@teambit/graph.cleargraph": "0.0.1",
28
28
  "@teambit/harmony": "0.4.6",
29
29
  "@teambit/component-id": "0.0.427",
30
- "@teambit/component": "0.0.1083",
31
- "@teambit/envs": "0.0.1083",
32
- "@teambit/logger": "0.0.820",
33
- "@teambit/tester": "0.0.1083",
34
- "@teambit/isolator": "0.0.1083",
35
- "@teambit/lane-id": "0.0.244",
36
- "@teambit/cli": "0.0.727",
37
- "@teambit/workspace": "0.0.1083",
38
- "@teambit/aspect-loader": "0.0.1083",
39
- "@teambit/aspect": "0.0.1083",
40
- "@teambit/generator": "0.0.1083",
41
- "@teambit/graphql": "0.0.1083",
42
- "@teambit/scope": "0.0.1083",
43
- "@teambit/ui": "0.0.1083",
44
- "@teambit/express": "0.0.825",
30
+ "@teambit/component": "0.0.1085",
31
+ "@teambit/envs": "0.0.1085",
32
+ "@teambit/logger": "0.0.822",
33
+ "@teambit/tester": "0.0.1085",
34
+ "@teambit/isolator": "0.0.1085",
35
+ "@teambit/lane-id": "0.0.246",
36
+ "@teambit/cli": "0.0.729",
37
+ "@teambit/workspace": "0.0.1085",
38
+ "@teambit/aspect-loader": "0.0.1085",
39
+ "@teambit/aspect": "0.0.1085",
40
+ "@teambit/generator": "0.0.1085",
41
+ "@teambit/global-config": "0.0.731",
42
+ "@teambit/graphql": "0.0.1085",
43
+ "@teambit/scope": "0.0.1085",
44
+ "@teambit/ui": "0.0.1085",
45
+ "@teambit/express": "0.0.827",
45
46
  "@teambit/bit-error": "0.0.402"
46
47
  },
47
48
  "devDependencies": {
@@ -59,7 +60,7 @@
59
60
  "@teambit/pipelines.aspect-docs.builder": "0.0.153"
60
61
  },
61
62
  "peerDependencies": {
62
- "@teambit/legacy": "1.0.507",
63
+ "@teambit/legacy": "1.0.510",
63
64
  "react": "^16.8.0 || ^17.0.0",
64
65
  "react-dom": "^16.8.0 || ^17.0.0"
65
66
  },