@teambit/builder 0.0.881 → 0.0.883
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact/artifact-extractor.js +6 -47
- package/dist/artifact/artifact-extractor.js.map +1 -1
- package/dist/artifact/artifact-factory.js +1 -52
- package/dist/artifact/artifact-factory.js.map +1 -1
- package/dist/artifact/artifact-list.js +6 -43
- package/dist/artifact/artifact-list.js.map +1 -1
- package/dist/artifact/artifact.js +4 -20
- package/dist/artifact/artifact.js.map +1 -1
- package/dist/artifact/artifacts.cmd.js +0 -29
- package/dist/artifact/artifacts.cmd.js.map +1 -1
- package/dist/artifact/extension-artifact.js +0 -4
- package/dist/artifact/extension-artifact.js.map +1 -1
- package/dist/artifact/fs-artifact.js +0 -6
- package/dist/artifact/fs-artifact.js.map +1 -1
- package/dist/artifact/index.js +0 -18
- package/dist/artifact/index.js.map +1 -1
- package/dist/build-pipe.js +2 -44
- package/dist/build-pipe.js.map +1 -1
- package/dist/build-pipeline-order.js +7 -44
- package/dist/build-pipeline-order.js.map +1 -1
- package/dist/build-pipeline-result-list.js +2 -35
- package/dist/build-pipeline-result-list.js.map +1 -1
- package/dist/build-task.js +1 -9
- package/dist/build-task.js.map +1 -1
- package/dist/build.cmd.js +0 -27
- package/dist/build.cmd.js.map +1 -1
- package/dist/builder.aspect.js +0 -5
- package/dist/builder.aspect.js.map +1 -1
- package/dist/builder.composition.js +0 -6
- package/dist/builder.composition.js.map +1 -1
- package/dist/builder.graphql.js +0 -19
- package/dist/builder.graphql.js.map +1 -1
- package/dist/builder.main.runtime.js +8 -137
- package/dist/builder.main.runtime.js.map +1 -1
- package/dist/builder.route.js +3 -27
- package/dist/builder.route.js.map +1 -1
- package/dist/builder.service.js +1 -37
- package/dist/builder.service.js.map +1 -1
- package/dist/exceptions/artifact-definition-no-glob.js +0 -3
- package/dist/exceptions/artifact-definition-no-glob.js.map +1 -1
- package/dist/exceptions/artifact-storage-error.js +0 -3
- package/dist/exceptions/artifact-storage-error.js.map +1 -1
- package/dist/exceptions/capsule-not-found.js +0 -3
- package/dist/exceptions/capsule-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -9
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/invalid-task.js +0 -6
- package/dist/exceptions/invalid-task.js.map +1 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +1 -1
- package/dist/pipeline/index.js +0 -3
- package/dist/pipeline/index.js.map +1 -1
- package/dist/pipeline/pipeline-results.js +0 -2
- package/dist/pipeline/pipeline-results.js.map +1 -1
- package/dist/storage/default-resolver.js +0 -9
- package/dist/storage/default-resolver.js.map +1 -1
- package/dist/storage/index.js +0 -6
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/s3-resolver.js +4 -0
- package/dist/storage/s3-resolver.js.map +1 -1
- package/dist/task-results-list.js +1 -23
- package/dist/task-results-list.js.map +1 -1
- package/dist/tasks-queue.js +0 -14
- package/dist/tasks-queue.js.map +1 -1
- package/dist/templates/build-task/files/index-file.js +0 -1
- package/dist/templates/build-task/files/index-file.js.map +1 -1
- package/dist/templates/build-task/files/task-file.js +0 -1
- package/dist/templates/build-task/files/task-file.js.map +1 -1
- package/dist/templates/build-task/index.js +0 -7
- package/dist/templates/build-task/index.js.map +1 -1
- package/package-tar/teambit-builder-0.0.883.tgz +0 -0
- package/package.json +11 -11
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-builder-0.0.881.tgz +0 -0
|
@@ -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","pipeResults","throwOnError","forceDeploy","disableTagAndSnapPipelines","isSnap","envsExecutionResults","build","emptyRootDir","skipTests","throwErrorsIfExist","allTasksResults","push","hasErrors","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","validateBuilderDataMap","forEach","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","length","Error","toString","join","getArtifactsVinylByAspect","aspectName","getArtifactsByAspect","vinyls","getVinylsAndImportIfMissing","_legacy","legacyScope","getArtifactsVinylByAspectAndName","getArtifactsByAspectAndName","getArtifactsVinylByAspectAndTaskName","getArtifactsbyAspectAndTaskName","getArtifactsByName","getArtifacts","byAspectNameAndName","undefined","byAspectNameAndTaskName","getDataByAspect","getBuilderData","data","find","aspectData","ArtifactList","fromArray","get","BuilderAspect","clonedData","cloneDeep","artifactFiles","artifact","files","ArtifactFiles","fromObject","Artifact","Object","assign","fromArtifactObject","builderOptions","ids","c","network","isolateComponents","createEnvironment","graphCapsules","getAllComponents","builderServiceOptions","seedersOnly","originalSeeders","buildResult","runOnce","previousTasksResults","listTasks","compEnv","getEnv","buildTasks","getCurrentPipeTasks","tagTasks","snapTasks","envId","registerBuildTasks","tasks","register","registerDeployTasks","registerTagTasks","registerSnapTasks","getDownloadUrlForArtifact","componentId","path","provider","cli","loggerExt","graphql","generator","config","artifactFactory","ArtifactFactory","logger","createLogger","BuilderService","registerService","builder","registerRoute","BuilderRoute","builderSchema","registerComponentTemplate","buildTaskTemplate","commands","BuilderCmd","ArtifactsCmd","Slot","withType","MainRuntime","CLIAspect","EnvsAspect","WorkspaceAspect","ScopeAspect","IsolatorAspect","LoggerAspect","AspectLoaderAspect","GraphqlAspect","GeneratorAspect","ComponentAspect","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 { 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 { 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 skipTests?: boolean;\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 ): Promise<OnTagResults> {\n const pipeResults: TaskResultsList[] = [];\n const { throwOnError, forceDeploy, disableTagAndSnapPipelines, isSnap } = options;\n const envsExecutionResults = await this.build(\n components,\n { emptyRootDir: true, ...isolateOptions },\n { skipTests: options.skipTests }\n );\n if (throwOnError && !forceDeploy) envsExecutionResults.throwErrorsIfExist();\n const allTasksResults = [...envsExecutionResults.tasksResults];\n pipeResults.push(envsExecutionResults);\n if (forceDeploy || (!disableTagAndSnapPipelines && !envsExecutionResults.hasErrors())) {\n const deployEnvsExecutionResults = isSnap\n ? await this.runSnapTasks(components, isolateOptions, envsExecutionResults.tasksResults)\n : await this.runTagTasks(components, isolateOptions, envsExecutionResults.tasksResults);\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 this.validateBuilderDataMap(builderDataMap);\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 // 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: Component, 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: Component): 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 clonedData.artifacts?.forEach((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 Object.assign(artifact, { files: artifactFiles });\n Object.assign(artifact, Artifact.fromArtifactObject(artifact));\n }\n });\n clonedData.artifacts = ArtifactList.fromArray(clonedData.artifacts || []);\n return clonedData;\n }\n\n /**\n * build given components for release.\n * for each one of the envs it runs a series of tasks.\n * in case of an error in a task, it stops the execution of that env and continue to the next\n * env. at the end, the results contain the data and errors per env.\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(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n previousTasksResults?: TaskResults[]\n ): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.tagService, {\n seedersOnly: isolateOptions?.seedersOnly,\n previousTasksResults,\n });\n\n return buildResult;\n }\n\n async runSnapTasks(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n previousTasksResults?: TaskResults[]\n ): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.snapService, {\n seedersOnly: isolateOptions?.seedersOnly,\n previousTasksResults,\n });\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 ];\n\n static async provider(\n [cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component]: [\n CLIMain,\n EnvsMain,\n Workspace,\n ScopeMain,\n IsolatorMain,\n LoggerMain,\n AspectLoaderMain,\n GraphqlMain,\n GeneratorMain,\n ComponentMain\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 component.registerRoute([new BuilderRoute(builder, scope, logger)]);\n graphql.register(builderSchema(builder));\n generator.registerComponentTemplate([buildTaskTemplate]);\n const commands = [new BuilderCmd(builder, workspace, logger), new ArtifactsCmd(builder, scope)];\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;E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c6E,UAAd,CAAyBvL,WAAzB"}
|
|
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","pipeResults","throwOnError","forceDeploy","disableTagAndSnapPipelines","isSnap","envsExecutionResults","build","emptyRootDir","skipTests","throwErrorsIfExist","allTasksResults","push","hasErrors","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","validateBuilderDataMap","forEach","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","length","Error","toString","join","getArtifactsVinylByAspect","aspectName","getArtifactsByAspect","vinyls","getVinylsAndImportIfMissing","_legacy","legacyScope","getArtifactsVinylByAspectAndName","getArtifactsByAspectAndName","getArtifactsVinylByAspectAndTaskName","getArtifactsbyAspectAndTaskName","getArtifactsByName","getArtifacts","byAspectNameAndName","undefined","byAspectNameAndTaskName","getDataByAspect","getBuilderData","data","find","aspectData","ArtifactList","fromArray","get","BuilderAspect","clonedData","cloneDeep","artifactFiles","artifact","files","ArtifactFiles","fromObject","Artifact","Object","assign","fromArtifactObject","builderOptions","ids","c","network","isolateComponents","createEnvironment","graphCapsules","getAllComponents","builderServiceOptions","seedersOnly","originalSeeders","buildResult","runOnce","previousTasksResults","listTasks","compEnv","getEnv","buildTasks","getCurrentPipeTasks","tagTasks","snapTasks","envId","registerBuildTasks","tasks","register","registerDeployTasks","registerTagTasks","registerSnapTasks","getDownloadUrlForArtifact","componentId","path","provider","cli","loggerExt","graphql","generator","config","artifactFactory","ArtifactFactory","logger","createLogger","BuilderService","registerService","builder","registerRoute","BuilderRoute","builderSchema","registerComponentTemplate","buildTaskTemplate","commands","BuilderCmd","ArtifactsCmd","Slot","withType","MainRuntime","CLIAspect","EnvsAspect","WorkspaceAspect","ScopeAspect","IsolatorAspect","LoggerAspect","AspectLoaderAspect","GraphqlAspect","GeneratorAspect","ComponentAspect","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 { 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 { 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 skipTests?: boolean;\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 ): Promise<OnTagResults> {\n const pipeResults: TaskResultsList[] = [];\n const { throwOnError, forceDeploy, disableTagAndSnapPipelines, isSnap } = options;\n const envsExecutionResults = await this.build(\n components,\n { emptyRootDir: true, ...isolateOptions },\n { skipTests: options.skipTests }\n );\n if (throwOnError && !forceDeploy) envsExecutionResults.throwErrorsIfExist();\n const allTasksResults = [...envsExecutionResults.tasksResults];\n pipeResults.push(envsExecutionResults);\n if (forceDeploy || (!disableTagAndSnapPipelines && !envsExecutionResults.hasErrors())) {\n const deployEnvsExecutionResults = isSnap\n ? await this.runSnapTasks(components, isolateOptions, envsExecutionResults.tasksResults)\n : await this.runTagTasks(components, isolateOptions, envsExecutionResults.tasksResults);\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 this.validateBuilderDataMap(builderDataMap);\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 // 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: Component, 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: Component): 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 clonedData.artifacts?.forEach((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 Object.assign(artifact, { files: artifactFiles });\n Object.assign(artifact, Artifact.fromArtifactObject(artifact));\n }\n });\n clonedData.artifacts = ArtifactList.fromArray(clonedData.artifacts || []);\n return clonedData;\n }\n\n /**\n * build given components for release.\n * for each one of the envs it runs a series of tasks.\n * in case of an error in a task, it stops the execution of that env and continue to the next\n * env. at the end, the results contain the data and errors per env.\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(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n previousTasksResults?: TaskResults[]\n ): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.tagService, {\n seedersOnly: isolateOptions?.seedersOnly,\n previousTasksResults,\n });\n\n return buildResult;\n }\n\n async runSnapTasks(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n previousTasksResults?: TaskResults[]\n ): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.snapService, {\n seedersOnly: isolateOptions?.seedersOnly,\n previousTasksResults,\n });\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 ];\n\n static async provider(\n [cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component]: [\n CLIMain,\n EnvsMain,\n Workspace,\n ScopeMain,\n IsolatorMain,\n LoggerMain,\n AspectLoaderMain,\n GraphqlMain,\n GeneratorMain,\n ComponentMain\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 component.registerRoute([new BuilderRoute(builder, scope, logger)]);\n graphql.register(builderSchema(builder));\n generator.registerComponentTemplate([buildTaskTemplate]);\n const commands = [new BuilderCmd(builder, workspace, logger), new ArtifactsCmd(builder, scope)];\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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WAAW,aA4QL4K,kBAAW;AAAA,gCA5QjB5K,WAAW,kBA6QA,CACpB6K,gBAAS,EACTC,kBAAU,EACVC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,4BAAe,EACfC,4BAAe,CAChB;AAgEH5E,wBAAa,CAAC6E,UAAU,CAACvL,WAAW,CAAC"}
|
package/dist/builder.route.js
CHANGED
|
@@ -1,55 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.regexp.exec.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.string.replace.js");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.routePath = exports.defaultExtension = exports.BuilderRoute = void 0;
|
|
17
|
-
|
|
18
12
|
function _defineProperty2() {
|
|
19
13
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
-
|
|
21
14
|
_defineProperty2 = function () {
|
|
22
15
|
return data;
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
return data;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
function _archiver() {
|
|
29
20
|
const data = _interopRequireDefault(require("archiver"));
|
|
30
|
-
|
|
31
21
|
_archiver = function () {
|
|
32
22
|
return data;
|
|
33
23
|
};
|
|
34
|
-
|
|
35
24
|
return data;
|
|
36
25
|
}
|
|
37
|
-
|
|
38
26
|
function _mime() {
|
|
39
27
|
const data = _interopRequireDefault(require("mime"));
|
|
40
|
-
|
|
41
28
|
_mime = function () {
|
|
42
29
|
return data;
|
|
43
30
|
};
|
|
44
|
-
|
|
45
31
|
return data;
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
const routePath = `builder`;
|
|
49
34
|
exports.routePath = routePath;
|
|
50
35
|
const defaultExtension = '.tgz';
|
|
51
36
|
exports.defaultExtension = defaultExtension;
|
|
52
|
-
|
|
53
37
|
class BuilderRoute {
|
|
54
38
|
constructor(builder, scope, logger) {
|
|
55
39
|
this.builder = builder;
|
|
@@ -63,8 +47,8 @@ class BuilderRoute {
|
|
|
63
47
|
const {
|
|
64
48
|
params
|
|
65
49
|
} = req;
|
|
66
|
-
const [aspectIdStr, filePath] = params[1].split('~');
|
|
67
|
-
|
|
50
|
+
const [aspectIdStr, filePath] = params[1].split('~');
|
|
51
|
+
// remove trailing slash
|
|
68
52
|
const aspectId = aspectIdStr.replace(/\/$/, '');
|
|
69
53
|
const artifacts = aspectId ? this.builder.getArtifactsByAspect(component, aspectId) : this.builder.getArtifacts(component);
|
|
70
54
|
if (!artifacts) return res.status(404).jsonp({
|
|
@@ -85,24 +69,20 @@ class BuilderRoute {
|
|
|
85
69
|
if (artifactFilesCount === 0) return res.status(404).jsonp({
|
|
86
70
|
error: `no artifacts found for component ${component.id} by aspect ${aspectId}`
|
|
87
71
|
});
|
|
88
|
-
|
|
89
72
|
if (artifactFilesCount === 1) {
|
|
90
73
|
const extensionWithArtifact = extensionsWithArtifacts.find(e => e.files.length > 0);
|
|
91
74
|
const fileName = `${extensionWithArtifact === null || extensionWithArtifact === void 0 ? void 0 : extensionWithArtifact.extensionId}_${extensionWithArtifact === null || extensionWithArtifact === void 0 ? void 0 : extensionWithArtifact.files[0].path}`;
|
|
92
75
|
const fileContent = extensionWithArtifact === null || extensionWithArtifact === void 0 ? void 0 : extensionWithArtifact.files[0].contents;
|
|
93
76
|
const fileExt = (extensionWithArtifact === null || extensionWithArtifact === void 0 ? void 0 : extensionWithArtifact.files[0].extname) || defaultExtension;
|
|
94
|
-
|
|
95
77
|
const contentType = _mime().default.getType(fileExt);
|
|
96
|
-
|
|
97
78
|
res.set('Content-disposition', `attachment; filename=${fileName}`);
|
|
98
79
|
if (contentType) res.set('Content-Type', contentType);
|
|
99
80
|
return res.send(fileContent);
|
|
100
81
|
}
|
|
82
|
+
|
|
101
83
|
/**
|
|
102
84
|
* if more than 1 file requested, zip them before sending
|
|
103
85
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
86
|
const archive = (0, _archiver().default)('tar', {
|
|
107
87
|
gzip: true
|
|
108
88
|
});
|
|
@@ -119,7 +99,6 @@ class BuilderRoute {
|
|
|
119
99
|
});
|
|
120
100
|
});
|
|
121
101
|
});
|
|
122
|
-
|
|
123
102
|
try {
|
|
124
103
|
archive.pipe(res);
|
|
125
104
|
/**
|
|
@@ -127,7 +106,6 @@ class BuilderRoute {
|
|
|
127
106
|
* resolving it results in setting the headers before the stream is finished
|
|
128
107
|
*/
|
|
129
108
|
// eslint-disable-next-line no-void
|
|
130
|
-
|
|
131
109
|
void archive.finalize();
|
|
132
110
|
return res.attachment(`${aspectId.replace('/', '_')}.tar`);
|
|
133
111
|
} catch (e) {
|
|
@@ -137,9 +115,7 @@ class BuilderRoute {
|
|
|
137
115
|
}
|
|
138
116
|
}]);
|
|
139
117
|
}
|
|
140
|
-
|
|
141
118
|
}
|
|
142
|
-
|
|
143
119
|
exports.BuilderRoute = BuilderRoute;
|
|
144
120
|
|
|
145
121
|
//# sourceMappingURL=builder.route.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["routePath","defaultExtension","BuilderRoute","constructor","builder","scope","logger","req","res","component","params","aspectIdStr","filePath","split","aspectId","replace","artifacts","getArtifactsByAspect","getArtifacts","status","jsonp","error","id","extensionsWithArtifacts","Promise","all","map","artifact","files","getVinylsAndImportIfMissing","_legacy","legacyScope","extensionId","task","filter","file","path","artifactFilesCount","reduce","accum","next","length","extensionWithArtifact","find","e","fileName","fileContent","contents","fileExt","extname","contentType","mime","getType","set","send","archive","archiver","gzip","on","warn","message","err","forEach","extensionWithArtifacts","append","name","pipe","finalize","attachment","toString"],"sources":["builder.route.ts"],"sourcesContent":["import { Request, Response, Route } from '@teambit/express';\nimport { Component } from '@teambit/component';\nimport archiver from 'archiver';\nimport { Logger } from '@teambit/logger';\nimport { ScopeMain } from '@teambit/scope';\nimport mime from 'mime';\nimport { BuilderMain } from './builder.main.runtime';\n\nexport const routePath = `builder`;\n\nexport type BuilderUrlParams = {\n aspectId?: string;\n filePath?: string;\n};\nexport const defaultExtension = '.tgz';\nexport class BuilderRoute implements Route {\n constructor(private builder: BuilderMain, private scope: ScopeMain, private logger: Logger) {}\n route = `/${routePath}/*`;\n method = 'get';\n\n middlewares = [\n async (req: Request<BuilderUrlParams>, res: Response) => {\n // @ts-ignore TODO: @guy please fix.\n const component = req.component as Component;\n const { params } = req;\n const [aspectIdStr, filePath] = params[1].split('~');\n // remove trailing slash\n const aspectId = aspectIdStr.replace(/\\/$/, '');\n const artifacts = aspectId\n ? this.builder.getArtifactsByAspect(component, aspectId)\n : this.builder.getArtifacts(component);\n if (!artifacts)\n return res\n .status(404)\n .jsonp({ error: `no artifacts found for component ${component.id} by aspect ${aspectId}` });\n const extensionsWithArtifacts = await Promise.all(\n artifacts.map(async (artifact) => {\n const files = await artifact.files.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n if (!filePath) return { extensionId: artifact.task.aspectId, files };\n return { extensionId: artifact.task.aspectId, files: files.filter((file) => file.path === filePath) };\n })\n );\n\n const artifactFilesCount = extensionsWithArtifacts.reduce((accum, next) => accum + next.files.length, 0);\n\n if (artifactFilesCount === 0)\n return res\n .status(404)\n .jsonp({ error: `no artifacts found for component ${component.id} by aspect ${aspectId}` });\n\n if (artifactFilesCount === 1) {\n const extensionWithArtifact = extensionsWithArtifacts.find((e) => e.files.length > 0);\n const fileName = `${extensionWithArtifact?.extensionId}_${extensionWithArtifact?.files[0].path}`;\n const fileContent = extensionWithArtifact?.files[0].contents;\n const fileExt = extensionWithArtifact?.files[0].extname || defaultExtension;\n const contentType = mime.getType(fileExt);\n res.set('Content-disposition', `attachment; filename=${fileName}`);\n if (contentType) res.set('Content-Type', contentType);\n return res.send(fileContent);\n }\n\n /**\n * if more than 1 file requested, zip them before sending\n */\n const archive = archiver('tar', { gzip: true });\n\n archive.on('warning', (warn) => {\n this.logger.warn(warn.message);\n });\n\n archive.on('error', (err) => {\n this.logger.error(err.message);\n });\n\n extensionsWithArtifacts.forEach((extensionWithArtifacts) => {\n extensionWithArtifacts.files.forEach((artifact) => {\n archive.append(artifact.contents, { name: `${extensionWithArtifacts.extensionId}_${artifact.path}` });\n });\n });\n\n try {\n archive.pipe(res);\n /**\n * promise that is returned from the await zip.finalize(); is resolved before the archive is actually finalized\n * resolving it results in setting the headers before the stream is finished\n */\n // eslint-disable-next-line no-void\n void archive.finalize();\n return res.attachment(`${aspectId.replace('/', '_')}.tar`);\n } catch (e: any) {\n return res.send({ error: e.toString() });\n }\n },\n ];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["routePath","defaultExtension","BuilderRoute","constructor","builder","scope","logger","req","res","component","params","aspectIdStr","filePath","split","aspectId","replace","artifacts","getArtifactsByAspect","getArtifacts","status","jsonp","error","id","extensionsWithArtifacts","Promise","all","map","artifact","files","getVinylsAndImportIfMissing","_legacy","legacyScope","extensionId","task","filter","file","path","artifactFilesCount","reduce","accum","next","length","extensionWithArtifact","find","e","fileName","fileContent","contents","fileExt","extname","contentType","mime","getType","set","send","archive","archiver","gzip","on","warn","message","err","forEach","extensionWithArtifacts","append","name","pipe","finalize","attachment","toString"],"sources":["builder.route.ts"],"sourcesContent":["import { Request, Response, Route } from '@teambit/express';\nimport { Component } from '@teambit/component';\nimport archiver from 'archiver';\nimport { Logger } from '@teambit/logger';\nimport { ScopeMain } from '@teambit/scope';\nimport mime from 'mime';\nimport { BuilderMain } from './builder.main.runtime';\n\nexport const routePath = `builder`;\n\nexport type BuilderUrlParams = {\n aspectId?: string;\n filePath?: string;\n};\nexport const defaultExtension = '.tgz';\nexport class BuilderRoute implements Route {\n constructor(private builder: BuilderMain, private scope: ScopeMain, private logger: Logger) {}\n route = `/${routePath}/*`;\n method = 'get';\n\n middlewares = [\n async (req: Request<BuilderUrlParams>, res: Response) => {\n // @ts-ignore TODO: @guy please fix.\n const component = req.component as Component;\n const { params } = req;\n const [aspectIdStr, filePath] = params[1].split('~');\n // remove trailing slash\n const aspectId = aspectIdStr.replace(/\\/$/, '');\n const artifacts = aspectId\n ? this.builder.getArtifactsByAspect(component, aspectId)\n : this.builder.getArtifacts(component);\n if (!artifacts)\n return res\n .status(404)\n .jsonp({ error: `no artifacts found for component ${component.id} by aspect ${aspectId}` });\n const extensionsWithArtifacts = await Promise.all(\n artifacts.map(async (artifact) => {\n const files = await artifact.files.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);\n if (!filePath) return { extensionId: artifact.task.aspectId, files };\n return { extensionId: artifact.task.aspectId, files: files.filter((file) => file.path === filePath) };\n })\n );\n\n const artifactFilesCount = extensionsWithArtifacts.reduce((accum, next) => accum + next.files.length, 0);\n\n if (artifactFilesCount === 0)\n return res\n .status(404)\n .jsonp({ error: `no artifacts found for component ${component.id} by aspect ${aspectId}` });\n\n if (artifactFilesCount === 1) {\n const extensionWithArtifact = extensionsWithArtifacts.find((e) => e.files.length > 0);\n const fileName = `${extensionWithArtifact?.extensionId}_${extensionWithArtifact?.files[0].path}`;\n const fileContent = extensionWithArtifact?.files[0].contents;\n const fileExt = extensionWithArtifact?.files[0].extname || defaultExtension;\n const contentType = mime.getType(fileExt);\n res.set('Content-disposition', `attachment; filename=${fileName}`);\n if (contentType) res.set('Content-Type', contentType);\n return res.send(fileContent);\n }\n\n /**\n * if more than 1 file requested, zip them before sending\n */\n const archive = archiver('tar', { gzip: true });\n\n archive.on('warning', (warn) => {\n this.logger.warn(warn.message);\n });\n\n archive.on('error', (err) => {\n this.logger.error(err.message);\n });\n\n extensionsWithArtifacts.forEach((extensionWithArtifacts) => {\n extensionWithArtifacts.files.forEach((artifact) => {\n archive.append(artifact.contents, { name: `${extensionWithArtifacts.extensionId}_${artifact.path}` });\n });\n });\n\n try {\n archive.pipe(res);\n /**\n * promise that is returned from the await zip.finalize(); is resolved before the archive is actually finalized\n * resolving it results in setting the headers before the stream is finished\n */\n // eslint-disable-next-line no-void\n void archive.finalize();\n return res.attachment(`${aspectId.replace('/', '_')}.tar`);\n } catch (e: any) {\n return res.send({ error: e.toString() });\n }\n },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,SAAS,GAAI,SAAQ;AAAC;AAM5B,MAAMC,gBAAgB,GAAG,MAAM;AAAC;AAChC,MAAMC,YAAY,CAAkB;EACzCC,WAAW,CAASC,OAAoB,EAAUC,KAAgB,EAAUC,MAAc,EAAE;IAAA,KAAxEF,OAAoB,GAApBA,OAAoB;IAAA,KAAUC,KAAgB,GAAhBA,KAAgB;IAAA,KAAUC,MAAc,GAAdA,MAAc;IAAA,+CACjF,IAAGN,SAAU,IAAG;IAAA,gDAChB,KAAK;IAAA,qDAEA,CACZ,OAAOO,GAA8B,EAAEC,GAAa,KAAK;MACvD;MACA,MAAMC,SAAS,GAAGF,GAAG,CAACE,SAAsB;MAC5C,MAAM;QAAEC;MAAO,CAAC,GAAGH,GAAG;MACtB,MAAM,CAACI,WAAW,EAAEC,QAAQ,CAAC,GAAGF,MAAM,CAAC,CAAC,CAAC,CAACG,KAAK,CAAC,GAAG,CAAC;MACpD;MACA,MAAMC,QAAQ,GAAGH,WAAW,CAACI,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC/C,MAAMC,SAAS,GAAGF,QAAQ,GACtB,IAAI,CAACV,OAAO,CAACa,oBAAoB,CAACR,SAAS,EAAEK,QAAQ,CAAC,GACtD,IAAI,CAACV,OAAO,CAACc,YAAY,CAACT,SAAS,CAAC;MACxC,IAAI,CAACO,SAA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O,CAACS,MAAM,CAACrC,QAAQ,CAACoB,QAAQ,EAAE;YAAEkB,IAAI,EAAG,GAAEF,sBAAsB,CAAC/B,WAAY,IAAGL,QAAQ,CAACS,IAAK;UAAE,CAAC,CAAC;QACvG,CAAC,CAAC;MACJ,CAAC,CAAC;MAEF,IAAI;QACFmB,OAAO,CAACW,IAAI,CAAC1D,GAAG,CAAC;QACjB;AACR;AACA;AACA;QACQ;QACA,KAAK+C,OAAO,CAACY,QAAQ,EAAE;QACvB,OAAO3D,GAAG,CAAC4D,UAAU,CAAE,GAAEtD,QAAQ,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAE,MAAK,CAAC;MAC5D,CAAC,CAAC,OAAO6B,CAAM,EAAE;QACf,OAAOpC,GAAG,CAAC8C,IAAI,CAAC;UAAEjC,KAAK,EAAEuB,CAAC,CAACyB,QAAQ;QAAG,CAAC,CAAC;MAC1C;IACF,CAAC,CACF;EA7E4F;AA8E/F;AAAC"}
|
package/dist/builder.service.js
CHANGED
|
@@ -1,100 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.BuilderService = void 0;
|
|
11
|
-
|
|
12
9
|
function _defineProperty2() {
|
|
13
10
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
|
|
15
11
|
_defineProperty2 = function () {
|
|
16
12
|
return data;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
return data;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
function _react() {
|
|
23
17
|
const data = _interopRequireDefault(require("react"));
|
|
24
|
-
|
|
25
18
|
_react = function () {
|
|
26
19
|
return data;
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
return data;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
function _pMapSeries() {
|
|
33
24
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
34
|
-
|
|
35
25
|
_pMapSeries = function () {
|
|
36
26
|
return data;
|
|
37
27
|
};
|
|
38
|
-
|
|
39
28
|
return data;
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
function _ink() {
|
|
43
31
|
const data = require("ink");
|
|
44
|
-
|
|
45
32
|
_ink = function () {
|
|
46
33
|
return data;
|
|
47
34
|
};
|
|
48
|
-
|
|
49
35
|
return data;
|
|
50
36
|
}
|
|
51
|
-
|
|
52
37
|
function _buildPipe() {
|
|
53
38
|
const data = require("./build-pipe");
|
|
54
|
-
|
|
55
39
|
_buildPipe = function () {
|
|
56
40
|
return data;
|
|
57
41
|
};
|
|
58
|
-
|
|
59
42
|
return data;
|
|
60
43
|
}
|
|
61
|
-
|
|
62
44
|
function _buildTask() {
|
|
63
45
|
const data = require("./build-task");
|
|
64
|
-
|
|
65
46
|
_buildTask = function () {
|
|
66
47
|
return data;
|
|
67
48
|
};
|
|
68
|
-
|
|
69
49
|
return data;
|
|
70
50
|
}
|
|
71
|
-
|
|
72
51
|
function _buildPipelineOrder() {
|
|
73
52
|
const data = require("./build-pipeline-order");
|
|
74
|
-
|
|
75
53
|
_buildPipelineOrder = function () {
|
|
76
54
|
return data;
|
|
77
55
|
};
|
|
78
|
-
|
|
79
56
|
return data;
|
|
80
57
|
}
|
|
81
|
-
|
|
82
58
|
function _builder() {
|
|
83
59
|
const data = require("./builder.aspect");
|
|
84
|
-
|
|
85
60
|
_builder = function () {
|
|
86
61
|
return data;
|
|
87
62
|
};
|
|
88
|
-
|
|
89
63
|
return data;
|
|
90
64
|
}
|
|
91
|
-
|
|
92
65
|
const pipeNames = {
|
|
93
66
|
getBuildPipe: 'build',
|
|
94
67
|
getTagPipe: 'tag',
|
|
95
68
|
getSnapPipe: 'snap'
|
|
96
69
|
};
|
|
97
|
-
|
|
98
70
|
class BuilderService {
|
|
99
71
|
constructor(
|
|
100
72
|
/**
|
|
@@ -126,11 +98,10 @@ class BuilderService {
|
|
|
126
98
|
this.scope = scope;
|
|
127
99
|
(0, _defineProperty2().default)(this, "name", 'builder');
|
|
128
100
|
}
|
|
101
|
+
|
|
129
102
|
/**
|
|
130
103
|
* runs all tasks for all envs
|
|
131
104
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
105
|
async runOnce(envsExecutionContext, options) {
|
|
135
106
|
const envs = envsExecutionContext.map(executionContext => executionContext.envDefinition);
|
|
136
107
|
const tasksQueue = (0, _buildPipelineOrder().calculatePipelineOrder)(this.taskSlot, envs, this.pipeNameOnEnv, options.tasks, options.skipTests);
|
|
@@ -167,7 +138,6 @@ class BuilderService {
|
|
|
167
138
|
buildResults.hasErrors() ? this.logger.consoleFailure() : this.logger.consoleSuccess();
|
|
168
139
|
return buildResults;
|
|
169
140
|
}
|
|
170
|
-
|
|
171
141
|
render(env) {
|
|
172
142
|
const pipes = this.getDescriptor(env);
|
|
173
143
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
@@ -177,7 +147,6 @@ class BuilderService {
|
|
|
177
147
|
tasks
|
|
178
148
|
}) => this.renderOnePipe(pipeName, tasks)));
|
|
179
149
|
}
|
|
180
|
-
|
|
181
150
|
renderOnePipe(pipeName, tasks) {
|
|
182
151
|
if (!tasks || !tasks.length) return null;
|
|
183
152
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
@@ -191,7 +160,6 @@ class BuilderService {
|
|
|
191
160
|
key: index
|
|
192
161
|
}, /*#__PURE__*/_react().default.createElement(_ink().Text, null, index + 1, ". ", task), /*#__PURE__*/_react().default.createElement(_ink().Newline, null))), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
|
193
162
|
}
|
|
194
|
-
|
|
195
163
|
getDescriptor(env) {
|
|
196
164
|
// @ts-ignore
|
|
197
165
|
const tasks = Object.keys(pipeNames).map(pipeFuncName => {
|
|
@@ -203,20 +171,16 @@ class BuilderService {
|
|
|
203
171
|
});
|
|
204
172
|
return tasks;
|
|
205
173
|
}
|
|
206
|
-
|
|
207
174
|
getTasksNamesByPipeFunc(env, pipeFuncName) {
|
|
208
175
|
const tasksQueue = (0, _buildPipelineOrder().calculatePipelineOrder)(this.taskSlot, [env], pipeFuncName).map(({
|
|
209
176
|
task
|
|
210
177
|
}) => _buildTask().BuildTaskHelper.serializeId(task));
|
|
211
178
|
return tasksQueue;
|
|
212
179
|
}
|
|
213
|
-
|
|
214
180
|
getCurrentPipeTasks(env) {
|
|
215
181
|
return this.getTasksNamesByPipeFunc(env, this.pipeNameOnEnv);
|
|
216
182
|
}
|
|
217
|
-
|
|
218
183
|
}
|
|
219
|
-
|
|
220
184
|
exports.BuilderService = BuilderService;
|
|
221
185
|
|
|
222
186
|
//# sourceMappingURL=builder.service.js.map
|
|
@@ -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","buildResults","execute","end","hasErrors","consoleFailure","consoleSuccess","render","env","pipes","getDescriptor","BuilderAspect","renderOnePipe","task","index","keys","pipeFuncName","getTasksNamesByPipeFunc","BuildTaskHelper","serializeId","getCurrentPipeTasks"],"sources":["builder.service.tsx"],"sourcesContent":["import { EnvDefinition, EnvService, ExecutionContext } 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, 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};\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 );\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 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;;AAoBA,MAAMA,SAAS,GAAG;EAChBC,YAAY,EAAE,OADE;EAEhBC,UAAU,EAAE,KAFI;EAGhBC,WAAW,EAAE;AAHG,CAAlB;;AAWO,MAAMC,cAAN,CAAmF;EAGxFC,WAAW;EACT;AACJ;AAC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AGgC,MAAM,CAACwB,IAAP,CAAY9E,SAAZ,EAAuBiB,GAAvB,CAA4B8D,YAAD,IAAqC;MAC5E,MAAM3D,UAAU,GAAG,KAAK4D,uBAAL,CAA6BT,GAA7B,EAAkCQ,YAAlC,CAAnB;MACA,OAAO;QAAEtB,QAAQ,EAAEzD,SAAS,CAAC+E,YAAD,CAArB;QAAqCzD,KAAK,EAAEF;MAA5C,CAAP;IACD,CAHa,CAAd;IAIA,OAAOE,KAAP;EACD;;EAEO0D,uBAAuB,CAACT,GAAD,EAAqBQ,YAArB,EAAgE;IAC7F,MAAM3D,UAAU,GAAG,IAAAC,4CAAA,EAAuB,KAAKb,QAA5B,EAAsC,CAAC+D,GAAD,CAAtC,EAA6CQ,YAA7C,EAA2D9D,GAA3D,CAA+D,CAAC;MAAE2D;IAAF,CAAD,KAChFK,4BAAA,CAAgBC,WAAhB,CAA4BN,IAA5B,CADiB,CAAnB;IAGA,OAAOxD,UAAP;EACD;;EAED+D,mBAAmB,CAACZ,GAAD,EAAqB;IACtC,OAAO,KAAKS,uBAAL,CAA6BT,GAA7B,EAAkC,KAAK9D,aAAvC,CAAP;EACD;;AAxIuF"}
|
|
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","buildResults","execute","end","hasErrors","consoleFailure","consoleSuccess","render","env","pipes","getDescriptor","BuilderAspect","renderOnePipe","task","index","keys","pipeFuncName","getTasksNamesByPipeFunc","BuildTaskHelper","serializeId","getCurrentPipeTasks"],"sources":["builder.service.tsx"],"sourcesContent":["import { EnvDefinition, EnvService, ExecutionContext } 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, 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};\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 );\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 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;AAoBA,MAAMA,SAAS,GAAG;EAChBC,YAAY,EAAE,OAAO;E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A,KAAK,GAAG,CAAC,QAAID,IAAI,CACb,eACP,+BAAC,cAAO,OAAG,CAEd,CAAC,eACF,+BAAC,cAAO,OAAG,CACN;EAEX;EAEAH,aAAa,CAACF,GAAkB,EAAE;IAChC;IACA,MAAMjD,KAAK,GAAGgC,MAAM,CAACwB,IAAI,CAAC9E,SAAS,CAAC,CAACiB,GAAG,CAAE8D,YAA+B,IAAK;MAC5E,MAAM3D,UAAU,GAAG,IAAI,CAAC4D,uBAAuB,CAACT,GAAG,EAAEQ,YAAY,CAAC;MAClE,OAAO;QAAEtB,QAAQ,EAAEzD,SAAS,CAAC+E,YAAY,CAAC;QAAEzD,KAAK,EAAEF;MAAW,CAAC;IACjE,CAAC,CAAC;IACF,OAAOE,KAAK;EACd;EAEQ0D,uBAAuB,CAACT,GAAkB,EAAEQ,YAA+B,EAAY;IAC7F,MAAM3D,UAAU,GAAG,IAAAC,4CAAsB,EAAC,IAAI,CAACb,QAAQ,EAAE,CAAC+D,GAAG,CAAC,EAAEQ,YAAY,CAAC,CAAC9D,GAAG,CAAC,CAAC;MAAE2D;IAAK,CAAC,KACzFK,4BAAe,CAACC,WAAW,CAACN,IAAI,CAAC,CAClC;IACD,OAAOxD,UAAU;EACnB;EAEA+D,mBAAmB,CAACZ,GAAkB,EAAE;IACtC,OAAO,IAAI,CAACS,uBAAuB,CAACT,GAAG,EAAE,IAAI,CAAC9D,aAAa,CAAC;EAC9D;AACF;AAAC"}
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ArtifactDefinitionError = void 0;
|
|
7
|
-
|
|
8
7
|
class ArtifactDefinitionError extends Error {
|
|
9
8
|
constructor() {
|
|
10
9
|
super(`must include glob or directories`);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
exports.ArtifactDefinitionError = ArtifactDefinitionError;
|
|
16
13
|
|
|
17
14
|
//# sourceMappingURL=artifact-definition-no-glob.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ArtifactDefinitionError","Error","constructor"],"sources":["artifact-definition-no-glob.ts"],"sourcesContent":["export class ArtifactDefinitionError extends Error {\n constructor() {\n super(`must include glob or directories`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ArtifactDefinitionError","Error","constructor"],"sources":["artifact-definition-no-glob.ts"],"sourcesContent":["export class ArtifactDefinitionError extends Error {\n constructor() {\n super(`must include glob or directories`);\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,uBAAuB,SAASC,KAAK,CAAC;EACjDC,WAAW,GAAG;IACZ,KAAK,CAAE,kCAAiC,CAAC;EAC3C;AACF;AAAC"}
|
|
@@ -4,16 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ArtifactStorageError = void 0;
|
|
7
|
-
|
|
8
7
|
class ArtifactStorageError extends Error {
|
|
9
8
|
constructor(originalError, component) {
|
|
10
9
|
super(`failed to store artifacts for component ${component.id.toString()}`);
|
|
11
10
|
this.originalError = originalError;
|
|
12
11
|
this.component = component;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
exports.ArtifactStorageError = ArtifactStorageError;
|
|
18
15
|
|
|
19
16
|
//# sourceMappingURL=artifact-storage-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ArtifactStorageError","Error","constructor","originalError","component","id","toString"],"sources":["artifact-storage-error.ts"],"sourcesContent":["import { Component } from '@teambit/component';\n\nexport class ArtifactStorageError extends Error {\n constructor(private originalError: Error, private component: Component) {\n super(`failed to store artifacts for component ${component.id.toString()}`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ArtifactStorageError","Error","constructor","originalError","component","id","toString"],"sources":["artifact-storage-error.ts"],"sourcesContent":["import { Component } from '@teambit/component';\n\nexport class ArtifactStorageError extends Error {\n constructor(private originalError: Error, private component: Component) {\n super(`failed to store artifacts for component ${component.id.toString()}`);\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,oBAAoB,SAASC,KAAK,CAAC;EAC9CC,WAAW,CAASC,aAAoB,EAAUC,SAAoB,EAAE;IACtE,KAAK,CAAE,2CAA0CA,SAAS,CAACC,EAAE,CAACC,QAAQ,EAAG,EAAC,CAAC;IAAC,KAD1DH,aAAoB,GAApBA,aAAoB;IAAA,KAAUC,SAAoB,GAApBA,SAAoB;EAEtE;AACF;AAAC"}
|
|
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CapsuleNotFound = void 0;
|
|
7
|
-
|
|
8
7
|
class CapsuleNotFound extends Error {
|
|
9
8
|
constructor(id) {
|
|
10
9
|
super(`unable to find capsule for component ${id.toString()}`);
|
|
11
10
|
this.id = id;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
exports.CapsuleNotFound = CapsuleNotFound;
|
|
17
14
|
|
|
18
15
|
//# sourceMappingURL=capsule-not-found.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CapsuleNotFound","Error","constructor","id","toString"],"sources":["capsule-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\n\nexport class CapsuleNotFound extends Error {\n constructor(private id: ComponentID) {\n super(`unable to find capsule for component ${id.toString()}`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CapsuleNotFound","Error","constructor","id","toString"],"sources":["capsule-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\n\nexport class CapsuleNotFound extends Error {\n constructor(private id: ComponentID) {\n super(`unable to find capsule for component ${id.toString()}`);\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,eAAe,SAASC,KAAK,CAAC;EACzCC,WAAW,CAASC,EAAe,EAAE;IACnC,KAAK,CAAE,wCAAuCA,EAAE,CAACC,QAAQ,EAAG,EAAC,CAAC;IAAC,KAD7CD,EAAe,GAAfA,EAAe;EAEnC;AACF;AAAC"}
|