@teambit/builder 0.0.1096 → 0.0.1098

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.
@@ -1,7 +1,9 @@
1
+ import { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';
1
2
  import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
2
3
  import React from 'react';
3
4
  import { ScopeMain } from '@teambit/scope';
4
5
  import pMapSeries from 'p-map-series';
6
+ import { GlobalConfigMain } from '@teambit/global-config';
5
7
  import { Text, Newline } from 'ink';
6
8
  import { Logger } from '@teambit/logger';
7
9
  import { IsolatorMain } from '@teambit/isolator';
@@ -80,7 +82,8 @@ export class BuilderService implements EnvService<BuildServiceResults, BuilderDe
80
82
  */
81
83
  private displayPipeName: PipeName,
82
84
  private artifactFactory: ArtifactFactory,
83
- private scope: ScopeMain
85
+ private scope: ScopeMain,
86
+ private globalConfig: GlobalConfigMain
84
87
  ) {}
85
88
 
86
89
  /**
@@ -101,19 +104,24 @@ export class BuilderService implements EnvService<BuildServiceResults, BuilderDe
101
104
  const longProcessLogger = this.logger.createLongProcessLogger(title);
102
105
  this.logger.consoleTitle(title);
103
106
  const envsBuildContext: EnvsBuildContext = {};
104
- const isolateOpts = {
105
- baseDir: options.capsulesBaseDir,
106
- useHash: !options.capsulesBaseDir,
107
+ const capsulesBaseDir = this.getComponentsCapsulesBaseDir();
108
+
109
+ const baseDir = options.capsulesBaseDir || capsulesBaseDir;
110
+ const useHash = !baseDir;
111
+ const isolateOptions = {
112
+ baseDir,
113
+ useHash,
107
114
  getExistingAsIs: true,
108
115
  seedersOnly: options.seedersOnly,
109
116
  };
117
+
110
118
  await pMapSeries(envsExecutionContext, async (executionContext) => {
111
119
  const componentIds = executionContext.components.map((component) => component.id);
112
120
  const { originalSeeders } = options;
113
121
  const originalSeedersOfThisEnv = componentIds.filter((compId) =>
114
122
  originalSeeders ? originalSeeders.find((seeder) => compId.isEqual(seeder)) : true
115
123
  );
116
- const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOpts);
124
+ const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOptions);
117
125
  capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;
118
126
  this.logger.console(
119
127
  `generated graph for env "${executionContext.id}", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`
@@ -142,6 +150,10 @@ export class BuilderService implements EnvService<BuildServiceResults, BuilderDe
142
150
  return buildResults;
143
151
  }
144
152
 
153
+ getComponentsCapsulesBaseDir(): string | undefined {
154
+ return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);
155
+ }
156
+
145
157
  render(env: EnvDefinition) {
146
158
  const pipes = this.getDescriptor(env);
147
159
 
@@ -78,7 +78,6 @@ export declare class BuilderMain {
78
78
  getArtifacts(component: IComponent): ArtifactList<Artifact>;
79
79
  getBuilderData(component: IComponent): BuilderData | undefined;
80
80
  build(components: Component[], isolateOptions?: IsolateComponentsOptions, builderOptions?: BuilderServiceOptions): Promise<TaskResultsList>;
81
- getComponentsCapsulesBaseDir(): string | undefined;
82
81
  runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList>;
83
82
  runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList>;
84
83
  listTasks(component: Component): {
@@ -79,13 +79,6 @@ function _globalConfig() {
79
79
  };
80
80
  return data;
81
81
  }
82
- function _constants() {
83
- const data = require("@teambit/legacy/dist/constants");
84
- _constants = function () {
85
- return data;
86
- };
87
- return data;
88
- }
89
82
  function _logger() {
90
83
  const data = require("@teambit/logger");
91
84
  _logger = function () {
@@ -436,7 +429,7 @@ class BuilderMain {
436
429
  }
437
430
  async build(components, isolateOptions, builderOptions) {
438
431
  const ids = components.map(c => c.id);
439
- const capsulesBaseDir = this.getComponentsCapsulesBaseDir();
432
+ const capsulesBaseDir = this.buildService.getComponentsCapsulesBaseDir();
440
433
  const baseIsolateOpts = {
441
434
  baseDir: capsulesBaseDir,
442
435
  useHash: !capsulesBaseDir
@@ -452,9 +445,6 @@ class BuilderMain {
452
445
  const buildResult = await envs.runOnce(this.buildService, builderServiceOptions);
453
446
  return buildResult;
454
447
  }
455
- getComponentsCapsulesBaseDir() {
456
- return this.globalConfig.getSync(_constants().CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);
457
- }
458
448
  async runTagTasks(components, builderOptions) {
459
449
  const envs = await this.envs.createEnvironment(components);
460
450
  const buildResult = await envs.runOnce(this.tagService, builderOptions);
@@ -519,10 +509,10 @@ class BuilderMain {
519
509
  static async provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig], config, [buildTaskSlot, tagTaskSlot, snapTaskSlot]) {
520
510
  const artifactFactory = new (_artifactFactory().ArtifactFactory)();
521
511
  const logger = loggerExt.createLogger(_builder().BuilderAspect.id);
522
- const buildService = new (_builder3().BuilderService)(isolator, logger, buildTaskSlot, 'getBuildPipe', 'build', artifactFactory, scope);
512
+ const buildService = new (_builder3().BuilderService)(isolator, logger, buildTaskSlot, 'getBuildPipe', 'build', artifactFactory, scope, globalConfig);
523
513
  envs.registerService(buildService);
524
- const tagService = new (_builder3().BuilderService)(isolator, logger, tagTaskSlot, 'getTagPipe', 'tag', artifactFactory, scope);
525
- const snapService = new (_builder3().BuilderService)(isolator, logger, snapTaskSlot, 'getSnapPipe', 'snap', artifactFactory, scope);
514
+ const tagService = new (_builder3().BuilderService)(isolator, logger, tagTaskSlot, 'getTagPipe', 'tag', artifactFactory, scope, globalConfig);
515
+ const snapService = new (_builder3().BuilderService)(isolator, logger, snapTaskSlot, 'getSnapPipe', 'snap', artifactFactory, scope, globalConfig);
526
516
  const builder = new BuilderMain(envs, workspace, buildService, tagService, snapService, scope, isolator, aspectLoader, component, globalConfig, buildTaskSlot, tagTaskSlot, snapTaskSlot);
527
517
  builder.registerBuildTasks([new (_ui().BundleUiTask)(ui, logger)]);
528
518
  component.registerRoute([new (_builder4().BuilderRoute)(builder, scope, logger)]);
@@ -1 +1 @@
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","populateArtifactsFrom","buildEnvsExecutionResults","build","emptyRootDir","tasks","AspectAspect","undefined","throwErrorsIfExist","push","hasErrors","builderOptionsForTagSnap","seedersOnly","previousTasksResults","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","combineBuildDataFrom","validateBuilderDataMap","forEach","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","length","Error","toString","join","promises","builderData","populateFrom","find","isEqual","ignoreVersion","idStr","populateFromComp","getHost","get","version","populateFromBuilderData","getBuilderData","artifact","artifactObj","toObject","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 populateArtifactsFrom?: ComponentID[]; // helpful for tagging from scope where we want to use the build-artifacts of previous 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, populateArtifactsFrom } = options;\n if (populateArtifactsFrom) isolateOptions.populateArtifactsFrom = populateArtifactsFrom;\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: populateArtifactsFrom ? [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 (populateArtifactsFrom) await this.combineBuildDataFrom(builderDataMap, populateArtifactsFrom);\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 combineBuildDataFrom(\n builderDataMap: ComponentMap<RawBuilderData>,\n populateArtifactsFrom: ComponentID[]\n ) {\n const promises = builderDataMap.map(async (builderData, component) => {\n const populateFrom = populateArtifactsFrom.find((id) => id.isEqual(component.id, { ignoreVersion: true }));\n const idStr = component.id.toString();\n if (!populateFrom) {\n throw new Error(`combineBuildDataFromParent: unable to find where to populate the artifacts from for ${idStr}`);\n }\n const populateFromComp = await this.componentAspect.getHost().get(populateFrom);\n if (!populateFromComp)\n throw new Error(\n `combineBuildDataFromParent, unable to load parent component of ${idStr}. hash: ${populateFrom.version}`\n );\n const populateFromBuilderData = this.getBuilderData(populateFromComp);\n if (!populateFromBuilderData) throw new Error(`parent of ${idStr} was not built yet. unable to continue`);\n populateFromBuilderData.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 populateFromBuilderData.aspectsData.forEach((aspectData) => {\n if (builderData.aspectsData.find((a) => a.aspectId === aspectData.aspectId)) return;\n builderData.aspectsData.push(aspectData);\n });\n populateFromBuilderData.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;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EA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AAQ,CAAC,GAAG2B,QAAQ,CAAC;IAEzB,OAAOP,OAAO;EAChB;AACF;AAAC;AAAA,gCAhZY9L,WAAW,WA8TP,CAACwM,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAa,CAAC;AAAA,gCA9TxFzM,WAAW,aAgUL0M,kBAAW;AAAA,gCAhUjB1M,WAAW,kBAiUA,CACpB2M,gBAAS,EACTC,kBAAU,EACVC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,4BAAe,EACfC,4BAAe,EACfC,cAAQ,EACRC,uBAAkB,CACnB;AAoEHnF,wBAAa,CAACoF,UAAU,CAACvN,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","populateArtifactsFrom","buildEnvsExecutionResults","build","emptyRootDir","tasks","AspectAspect","undefined","throwErrorsIfExist","push","hasErrors","builderOptionsForTagSnap","seedersOnly","previousTasksResults","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","combineBuildDataFrom","validateBuilderDataMap","forEach","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","length","Error","toString","join","promises","builderData","populateFrom","find","isEqual","ignoreVersion","idStr","populateFromComp","getHost","get","version","populateFromBuilderData","getBuilderData","artifact","artifactObj","toObject","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","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 { 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 populateArtifactsFrom?: ComponentID[]; // helpful for tagging from scope where we want to use the build-artifacts of previous 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, populateArtifactsFrom } = options;\n if (populateArtifactsFrom) isolateOptions.populateArtifactsFrom = populateArtifactsFrom;\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: populateArtifactsFrom ? [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 (populateArtifactsFrom) await this.combineBuildDataFrom(builderDataMap, populateArtifactsFrom);\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 combineBuildDataFrom(\n builderDataMap: ComponentMap<RawBuilderData>,\n populateArtifactsFrom: ComponentID[]\n ) {\n const promises = builderDataMap.map(async (builderData, component) => {\n const populateFrom = populateArtifactsFrom.find((id) => id.isEqual(component.id, { ignoreVersion: true }));\n const idStr = component.id.toString();\n if (!populateFrom) {\n throw new Error(`combineBuildDataFromParent: unable to find where to populate the artifacts from for ${idStr}`);\n }\n const populateFromComp = await this.componentAspect.getHost().get(populateFrom);\n if (!populateFromComp)\n throw new Error(\n `combineBuildDataFromParent, unable to load parent component of ${idStr}. hash: ${populateFrom.version}`\n );\n const populateFromBuilderData = this.getBuilderData(populateFromComp);\n if (!populateFromBuilderData) throw new Error(`parent of ${idStr} was not built yet. unable to continue`);\n populateFromBuilderData.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 populateFromBuilderData.aspectsData.forEach((aspectData) => {\n if (builderData.aspectsData.find((a) => a.aspectId === aspectData.aspectId)) return;\n builderData.aspectsData.push(aspectData);\n });\n populateFromBuilderData.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.buildService.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 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 globalConfig\n );\n envs.registerService(buildService);\n const tagService = new BuilderService(\n isolator,\n logger,\n tagTaskSlot,\n 'getTagPipe',\n 'tag',\n artifactFactory,\n scope,\n globalConfig\n );\n const snapService = new BuilderService(\n isolator,\n logger,\n snapTaskSlot,\n 'getSnapPipe',\n 'snap',\n artifactFactory,\n scope,\n globalConfig\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;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IA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qL,MAAM,CAAC,EAAE,KAAIa,yBAAY,EAACT,OAAO,EAAElK,SAAS,CAAC,CAAC;IACnGsJ,GAAG,CAACR,QAAQ,CAAC,GAAG2B,QAAQ,CAAC;IAEzB,OAAOP,OAAO;EAChB;AACF;AAAC;AAAA,gCAvZY5L,WAAW,WA0TP,CAACsM,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAa,CAAC;AAAA,gCA1TxFvM,WAAW,aA4TLwM,kBAAW;AAAA,gCA5TjBxM,WAAW,kBA6TA,CACpByM,gBAAS,EACTC,kBAAU,EACVC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,4BAAe,EACfC,4BAAe,EACfC,cAAQ,EACRC,uBAAkB,CACnB;AA+EHjF,wBAAa,CAACkF,UAAU,CAACrN,WAAW,CAAC"}
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
3
3
  import { ScopeMain } from '@teambit/scope';
4
+ import { GlobalConfigMain } from '@teambit/global-config';
4
5
  import { Logger } from '@teambit/logger';
5
6
  import { IsolatorMain } from '@teambit/isolator';
6
7
  import { Component, ComponentID } from '@teambit/component';
@@ -67,6 +68,7 @@ export declare class BuilderService implements EnvService<BuildServiceResults, B
67
68
  private displayPipeName;
68
69
  private artifactFactory;
69
70
  private scope;
71
+ private globalConfig;
70
72
  name: string;
71
73
  constructor(
72
74
  /**
@@ -88,11 +90,12 @@ export declare class BuilderService implements EnvService<BuildServiceResults, B
88
90
  /**
89
91
  * pipe name to display on the console during the execution
90
92
  */
91
- displayPipeName: PipeName, artifactFactory: ArtifactFactory, scope: ScopeMain);
93
+ displayPipeName: PipeName, artifactFactory: ArtifactFactory, scope: ScopeMain, globalConfig: GlobalConfigMain);
92
94
  /**
93
95
  * runs all tasks for all envs
94
96
  */
95
97
  runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList>;
98
+ getComponentsCapsulesBaseDir(): string | undefined;
96
99
  render(env: EnvDefinition): JSX.Element;
97
100
  transform(env: Env, envContext: EnvContext): BuilderTransformationMap | undefined;
98
101
  private renderOnePipe;
@@ -13,6 +13,13 @@ function _defineProperty2() {
13
13
  };
14
14
  return data;
15
15
  }
16
+ function _constants() {
17
+ const data = require("@teambit/legacy/dist/constants");
18
+ _constants = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
16
23
  function _react() {
17
24
  const data = _interopRequireDefault(require("react"));
18
25
  _react = function () {
@@ -88,7 +95,7 @@ class BuilderService {
88
95
  /**
89
96
  * pipe name to display on the console during the execution
90
97
  */
91
- displayPipeName, artifactFactory, scope) {
98
+ displayPipeName, artifactFactory, scope, globalConfig) {
92
99
  this.isolator = isolator;
93
100
  this.logger = logger;
94
101
  this.taskSlot = taskSlot;
@@ -96,6 +103,7 @@ class BuilderService {
96
103
  this.displayPipeName = displayPipeName;
97
104
  this.artifactFactory = artifactFactory;
98
105
  this.scope = scope;
106
+ this.globalConfig = globalConfig;
99
107
  (0, _defineProperty2().default)(this, "name", 'builder');
100
108
  }
101
109
 
@@ -111,9 +119,12 @@ class BuilderService {
111
119
  const longProcessLogger = this.logger.createLongProcessLogger(title);
112
120
  this.logger.consoleTitle(title);
113
121
  const envsBuildContext = {};
114
- const isolateOpts = {
115
- baseDir: options.capsulesBaseDir,
116
- useHash: !options.capsulesBaseDir,
122
+ const capsulesBaseDir = this.getComponentsCapsulesBaseDir();
123
+ const baseDir = options.capsulesBaseDir || capsulesBaseDir;
124
+ const useHash = !baseDir;
125
+ const isolateOptions = {
126
+ baseDir,
127
+ useHash,
117
128
  getExistingAsIs: true,
118
129
  seedersOnly: options.seedersOnly
119
130
  };
@@ -123,7 +134,7 @@ class BuilderService {
123
134
  originalSeeders
124
135
  } = options;
125
136
  const originalSeedersOfThisEnv = componentIds.filter(compId => originalSeeders ? originalSeeders.find(seeder => compId.isEqual(seeder)) : true);
126
- const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOpts);
137
+ const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOptions);
127
138
  capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;
128
139
  this.logger.console(`generated graph for env "${executionContext.id}", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`);
129
140
  const buildContext = Object.assign(executionContext, {
@@ -143,6 +154,9 @@ class BuilderService {
143
154
  buildResults.hasErrors() ? this.logger.consoleFailure() : this.logger.consoleSuccess();
144
155
  return buildResults;
145
156
  }
157
+ getComponentsCapsulesBaseDir() {
158
+ return this.globalConfig.getSync(_constants().CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);
159
+ }
146
160
  render(env) {
147
161
  const pipes = this.getDescriptor(env);
148
162
  return /*#__PURE__*/_react().default.createElement(_ink().Text, {
@@ -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","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;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;AA4BA,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;IAAA,KAKdC,QAAkB,GAAlBA,QAAkB;IAAA,KAKlBC,aAAgC,GAAhCA,aAAgC;IAAA,KAKhCC,eAAyB,GAAzBA,eAAyB;IAAA,KACzBC,eAAgC,GAAhCA,eAAgC;IAAA,KAChCC,KAAgB,GAAhBA,KAAgB;IAAA,8CA5BnB,SAAS;EA6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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
+ {"version":3,"names":["pipeNames","getBuildPipe","getTagPipe","getSnapPipe","BuilderService","constructor","isolator","logger","taskSlot","pipeNameOnEnv","displayPipeName","artifactFactory","scope","globalConfig","runOnce","envsExecutionContext","options","envs","map","executionContext","envDefinition","tasksQueue","calculatePipelineOrder","tasks","skipTests","validate","info","toString","title","length","longProcessLogger","createLongProcessLogger","consoleTitle","envsBuildContext","capsulesBaseDir","getComponentsCapsulesBaseDir","baseDir","useHash","isolateOptions","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","getSync","CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR","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 { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';\nimport { 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 { GlobalConfigMain } from '@teambit/global-config';\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 private globalConfig: GlobalConfigMain\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 capsulesBaseDir = this.getComponentsCapsulesBaseDir();\n\n const baseDir = options.capsulesBaseDir || capsulesBaseDir;\n const useHash = !baseDir;\n const isolateOptions = {\n baseDir,\n useHash,\n getExistingAsIs: true,\n seedersOnly: options.seedersOnly,\n };\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, isolateOptions);\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 getComponentsCapsulesBaseDir(): string | undefined {\n return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);\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":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;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;AA4BA,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,EAChBC,YAA8B,EACtC;IAAA,KAxBQP,QAAsB,GAAtBA,QAAsB;IAAA,KAKtBC,MAAc,GAAdA,MAAc;IAAA,KAKdC,QAAkB,GAAlBA,QAAkB;IAAA,KAKlBC,aAAgC,GAAhCA,aAAgC;IAAA,KAKhCC,eAAyB,GAAzBA,eAAyB;IAAA,KACzBC,eAAgC,GAAhCA,eAAgC;IAAA,KAChCC,KAAgB,GAAhBA,KAAgB;IAAA,KAChBC,YAA8B,GAA9BA,YAA8B;IAAA,8CA7BjC,SAAS;EA8Bb;;EAEH;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jB,GAAkB,EAAEgB,YAA+B,EAAY;IAC7F,MAAM3E,UAAU,GAAG,IAAAC,4CAAsB,EAAC,IAAI,CAACd,QAAQ,EAAE,CAACwE,GAAG,CAAC,EAAEgB,YAAY,CAAC,CAAC9E,GAAG,CAAC,CAAC;MAAE2E;IAAK,CAAC,KACzFK,4BAAe,CAACC,WAAW,CAACN,IAAI,CAAC,CAClC;IACD,OAAOxE,UAAU;EACnB;EAEA+E,mBAAmB,CAACpB,GAAkB,EAAE;IACtC,OAAO,IAAI,CAACiB,uBAAuB,CAACjB,GAAG,EAAE,IAAI,CAACvE,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.1096/dist/builder.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1096/dist/builder.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1098/dist/builder.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.1098/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.1096",
3
+ "version": "0.0.1098",
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.1096"
9
+ "version": "0.0.1098"
10
10
  },
11
11
  "dependencies": {
12
12
  "p-map-series": "2.1.0",
@@ -27,22 +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.1096",
31
- "@teambit/envs": "0.0.1096",
32
- "@teambit/logger": "0.0.829",
33
- "@teambit/tester": "0.0.1096",
34
- "@teambit/isolator": "0.0.1096",
35
- "@teambit/lane-id": "0.0.253",
36
- "@teambit/cli": "0.0.736",
37
- "@teambit/workspace": "0.0.1096",
38
- "@teambit/aspect-loader": "0.0.1096",
39
- "@teambit/aspect": "0.0.1096",
40
- "@teambit/generator": "0.0.1096",
41
- "@teambit/global-config": "0.0.738",
42
- "@teambit/graphql": "0.0.1096",
43
- "@teambit/scope": "0.0.1096",
44
- "@teambit/ui": "0.0.1096",
45
- "@teambit/express": "0.0.834",
30
+ "@teambit/component": "0.0.1098",
31
+ "@teambit/envs": "0.0.1098",
32
+ "@teambit/logger": "0.0.830",
33
+ "@teambit/tester": "0.0.1098",
34
+ "@teambit/isolator": "0.0.1098",
35
+ "@teambit/lane-id": "0.0.254",
36
+ "@teambit/cli": "0.0.737",
37
+ "@teambit/workspace": "0.0.1098",
38
+ "@teambit/aspect-loader": "0.0.1098",
39
+ "@teambit/aspect": "0.0.1098",
40
+ "@teambit/generator": "0.0.1098",
41
+ "@teambit/global-config": "0.0.739",
42
+ "@teambit/graphql": "0.0.1098",
43
+ "@teambit/scope": "0.0.1098",
44
+ "@teambit/ui": "0.0.1098",
45
+ "@teambit/express": "0.0.835",
46
46
  "@teambit/bit-error": "0.0.402"
47
47
  },
48
48
  "devDependencies": {
@@ -60,7 +60,7 @@
60
60
  "@teambit/pipelines.aspect-docs.builder": "0.0.153"
61
61
  },
62
62
  "peerDependencies": {
63
- "@teambit/legacy": "1.0.517",
63
+ "@teambit/legacy": "1.0.518",
64
64
  "react": "^16.8.0 || ^17.0.0",
65
65
  "react-dom": "^16.8.0 || ^17.0.0"
66
66
  },