@teambit/builder 0.0.636 → 0.0.640

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 +1 @@
1
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.636/dist/builder.docs.mdx')]
1
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@0.0.640/dist/builder.docs.mdx')]
@@ -175,7 +175,7 @@ class BuildPipe {
175
175
  const {
176
176
  aspectId,
177
177
  name
178
- } = _buildTask().BuildTaskHelper.deserializeId(dependency);
178
+ } = _buildTask().BuildTaskHelper.deserializeIdAllowEmptyName(dependency);
179
179
 
180
180
  this.failedDependencyTask = this.failedTasks.find(failedTask => {
181
181
  if (name && name !== failedTask.name) return false;
@@ -1 +1 @@
1
- {"version":3,"sources":["build-pipe.ts"],"names":["BuildPipe","constructor","tasksQueue","envsBuildContext","logger","artifactFactory","previousTaskResults","allTasksResults","taskResults","execute","executePreBuild","longProcessLogger","createLongProcessLogger","length","task","env","executeTask","end","tasksResultsList","TaskResultsList","executePostBuild","setStatusLine","preBuild","getBuildContext","id","consoleSuccess","taskId","BuildTaskHelper","serializeId","taskName","description","logProgress","updateFailedDependencyTask","shouldSkipTask","startTask","process","hrtime","taskStartTime","Date","now","buildContext","buildTaskResult","endTime","compsWithErrors","componentsResults","filter","c","errors","artifacts","consoleFailure","failedTasks","push","duration","defs","generate","startTime","tasksResults","postBuild","failedDependencyTask","dependencies","forEach","dependency","aspectId","name","deserializeId","find","failedTask","envId","failedTaskId","consoleWarning","Error","previousTasksResults","from"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;A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S,EAITC,eAJS,EAKTC,mBALS,EAMT;AACA,WAAO,IAAIN,SAAJ,CAAcE,UAAd,EAA0BC,gBAA1B,EAA4CC,MAA5C,EAAoDC,eAApD,EAAqEC,mBAArE,CAAP;AACD;;AA9HoB","sourcesContent":["import { EnvDefinition } from '@teambit/envs';\nimport { ComponentMap } from '@teambit/component';\nimport { Logger, LongProcessLogger } from '@teambit/logger';\nimport mapSeries from 'p-map-series';\nimport prettyTime from 'pretty-time';\nimport { ArtifactFactory, ArtifactList } from './artifact';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { ComponentResult } from './types';\nimport { TasksQueue } from './tasks-queue';\nimport { EnvsBuildContext } from './builder.service';\nimport { TaskResultsList } from './task-results-list';\n\nexport type TaskResults = {\n /**\n * task itself. useful for getting its id/description later on.\n */\n task: BuildTask;\n\n /**\n * environment were the task was running\n */\n env: EnvDefinition;\n\n /**\n * component build results.\n */\n componentsResults: ComponentResult[];\n\n /**\n * artifacts generated by the build pipeline.\n * in case the task finished with errors, this prop is undefined.\n */\n artifacts: ComponentMap<ArtifactList> | undefined;\n\n /**\n * timestamp of start initiation.\n */\n startTime: number;\n\n /**\n * timestamp of task completion.\n */\n endTime: number;\n};\n\nexport class BuildPipe {\n private failedTasks: BuildTask[] = [];\n private failedDependencyTask: BuildTask | undefined;\n private longProcessLogger: LongProcessLogger;\n private taskResults: TaskResults[] = [];\n constructor(\n /**\n * array of services to apply on the components.\n */\n readonly tasksQueue: TasksQueue,\n readonly envsBuildContext: EnvsBuildContext,\n readonly logger: Logger,\n readonly artifactFactory: ArtifactFactory,\n private previousTaskResults?: TaskResults[]\n ) {}\n\n get allTasksResults(): TaskResults[] {\n return [...(this.previousTaskResults || []), ...(this.taskResults || [])];\n }\n\n /**\n * execute a pipeline of build tasks.\n */\n async execute(): Promise<TaskResultsList> {\n await this.executePreBuild();\n this.longProcessLogger = this.logger.createLongProcessLogger('running tasks', this.tasksQueue.length);\n await mapSeries(this.tasksQueue, async ({ task, env }) => this.executeTask(task, env));\n this.longProcessLogger.end();\n const tasksResultsList = new TaskResultsList(this.tasksQueue, this.taskResults);\n await this.executePostBuild(tasksResultsList);\n\n return tasksResultsList;\n }\n\n private async executePreBuild() {\n this.logger.setStatusLine('executing pre-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.preBuild) return;\n await task.preBuild(this.getBuildContext(env.id));\n });\n this.logger.consoleSuccess();\n }\n\n private async executeTask(task: BuildTask, env: EnvDefinition): Promise<void> {\n const taskId = BuildTaskHelper.serializeId(task);\n const taskName = `${taskId}${task.description ? ` (${task.description})` : ''}`;\n this.longProcessLogger.logProgress(`env \"${env.id}\", task \"${taskName}\"`);\n this.updateFailedDependencyTask(task);\n if (this.shouldSkipTask(taskId, env.id)) {\n return;\n }\n const startTask = process.hrtime();\n const taskStartTime = Date.now();\n const buildContext = this.getBuildContext(env.id);\n const buildTaskResult = await task.execute(buildContext);\n const endTime = Date.now();\n const compsWithErrors = buildTaskResult.componentsResults.filter((c) => c.errors?.length);\n let artifacts;\n if (compsWithErrors.length) {\n this.logger.consoleFailure(`env: ${env.id}, task \"${taskId}\" has failed`);\n this.failedTasks.push(task);\n } else {\n const duration = prettyTime(process.hrtime(startTask));\n this.logger.consoleSuccess(`env \"${env.id}\", task \"${taskName}\" has completed successfully in ${duration}`);\n const defs = buildTaskResult.artifacts || [];\n artifacts = this.artifactFactory.generate(buildContext, defs, task);\n }\n\n const taskResults: TaskResults = {\n task,\n env,\n componentsResults: buildTaskResult.componentsResults,\n artifacts,\n startTime: taskStartTime,\n endTime,\n };\n\n this.taskResults.push(taskResults);\n }\n\n private async executePostBuild(tasksResults: TaskResultsList) {\n this.logger.setStatusLine('executing post-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.postBuild) return;\n await task.postBuild(this.getBuildContext(env.id), tasksResults);\n });\n this.logger.consoleSuccess();\n }\n\n private updateFailedDependencyTask(task: BuildTask) {\n if (!this.failedDependencyTask && this.failedTasks.length && task.dependencies) {\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeId(dependency);\n this.failedDependencyTask = this.failedTasks.find((failedTask) => {\n if (name && name !== failedTask.name) return false;\n return aspectId === failedTask.aspectId;\n });\n });\n }\n }\n\n private shouldSkipTask(taskId: string, envId: string): boolean {\n if (!this.failedDependencyTask) return false;\n const failedTaskId = BuildTaskHelper.serializeId(this.failedDependencyTask);\n this.logger.consoleWarning(`env: ${envId}, task \"${taskId}\" has skipped due to \"${failedTaskId}\" failure`);\n return true;\n }\n\n private getBuildContext(envId: string) {\n const buildContext = this.envsBuildContext[envId];\n if (!buildContext) throw new Error(`unable to find buildContext for ${envId}`);\n buildContext.previousTasksResults = this.allTasksResults;\n return buildContext;\n }\n\n /**\n * create a build pipe from an array of tasks.\n */\n static from(\n tasksQueue: TasksQueue,\n envsBuildContext: EnvsBuildContext,\n logger: Logger,\n artifactFactory: ArtifactFactory,\n previousTaskResults?: TaskResults[]\n ) {\n return new BuildPipe(tasksQueue, envsBuildContext, logger, artifactFactory, previousTaskResults);\n }\n}\n"]}
1
+ {"version":3,"sources":["build-pipe.ts"],"names":["BuildPipe","constructor","tasksQueue","envsBuildContext","logger","artifactFactory","previousTaskResults","allTasksResults","taskResults","execute","executePreBuild","longProcessLogger","createLongProcessLogger","length","task","env","executeTask","end","tasksResultsList","TaskResultsList","executePostBuild","setStatusLine","preBuild","getBuildContext","id","consoleSuccess","taskId","BuildTaskHelper","serializeId","taskName","description","logProgress","updateFailedDependencyTask","shouldSkipTask","startTask","process","hrtime","taskStartTime","Date","now","buildContext","buildTaskResult","endTime","compsWithErrors","componentsResults","filter","c","errors","artifacts","consoleFailure","failedTasks","push","duration","defs","generate","startTime","tasksResults","postBuild","failedDependencyTask","dependencies","forEach","dependency","aspectId","name","deserializeIdAllowEmptyName","find","failedTask","envId","failedTaskId","consoleWarning","Error","previousTasksResults","from"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;A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AAKhE,eAAzC;AACA,WAAOiC,YAAP;AACD;AAED;AACF;AACA;;;AACa,SAAJgC,IAAI,CACTtE,UADS,EAETC,gBAFS,EAGTC,MAHS,EAITC,eAJS,EAKTC,mBALS,EAMT;AACA,WAAO,IAAIN,SAAJ,CAAcE,UAAd,EAA0BC,gBAA1B,EAA4CC,MAA5C,EAAoDC,eAApD,EAAqEC,mBAArE,CAAP;AACD;;AA9HoB","sourcesContent":["import { EnvDefinition } from '@teambit/envs';\nimport { ComponentMap } from '@teambit/component';\nimport { Logger, LongProcessLogger } from '@teambit/logger';\nimport mapSeries from 'p-map-series';\nimport prettyTime from 'pretty-time';\nimport { ArtifactFactory, ArtifactList } from './artifact';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { ComponentResult } from './types';\nimport { TasksQueue } from './tasks-queue';\nimport { EnvsBuildContext } from './builder.service';\nimport { TaskResultsList } from './task-results-list';\n\nexport type TaskResults = {\n /**\n * task itself. useful for getting its id/description later on.\n */\n task: BuildTask;\n\n /**\n * environment were the task was running\n */\n env: EnvDefinition;\n\n /**\n * component build results.\n */\n componentsResults: ComponentResult[];\n\n /**\n * artifacts generated by the build pipeline.\n * in case the task finished with errors, this prop is undefined.\n */\n artifacts: ComponentMap<ArtifactList> | undefined;\n\n /**\n * timestamp of start initiation.\n */\n startTime: number;\n\n /**\n * timestamp of task completion.\n */\n endTime: number;\n};\n\nexport class BuildPipe {\n private failedTasks: BuildTask[] = [];\n private failedDependencyTask: BuildTask | undefined;\n private longProcessLogger: LongProcessLogger;\n private taskResults: TaskResults[] = [];\n constructor(\n /**\n * array of services to apply on the components.\n */\n readonly tasksQueue: TasksQueue,\n readonly envsBuildContext: EnvsBuildContext,\n readonly logger: Logger,\n readonly artifactFactory: ArtifactFactory,\n private previousTaskResults?: TaskResults[]\n ) {}\n\n get allTasksResults(): TaskResults[] {\n return [...(this.previousTaskResults || []), ...(this.taskResults || [])];\n }\n\n /**\n * execute a pipeline of build tasks.\n */\n async execute(): Promise<TaskResultsList> {\n await this.executePreBuild();\n this.longProcessLogger = this.logger.createLongProcessLogger('running tasks', this.tasksQueue.length);\n await mapSeries(this.tasksQueue, async ({ task, env }) => this.executeTask(task, env));\n this.longProcessLogger.end();\n const tasksResultsList = new TaskResultsList(this.tasksQueue, this.taskResults);\n await this.executePostBuild(tasksResultsList);\n\n return tasksResultsList;\n }\n\n private async executePreBuild() {\n this.logger.setStatusLine('executing pre-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.preBuild) return;\n await task.preBuild(this.getBuildContext(env.id));\n });\n this.logger.consoleSuccess();\n }\n\n private async executeTask(task: BuildTask, env: EnvDefinition): Promise<void> {\n const taskId = BuildTaskHelper.serializeId(task);\n const taskName = `${taskId}${task.description ? ` (${task.description})` : ''}`;\n this.longProcessLogger.logProgress(`env \"${env.id}\", task \"${taskName}\"`);\n this.updateFailedDependencyTask(task);\n if (this.shouldSkipTask(taskId, env.id)) {\n return;\n }\n const startTask = process.hrtime();\n const taskStartTime = Date.now();\n const buildContext = this.getBuildContext(env.id);\n const buildTaskResult = await task.execute(buildContext);\n const endTime = Date.now();\n const compsWithErrors = buildTaskResult.componentsResults.filter((c) => c.errors?.length);\n let artifacts;\n if (compsWithErrors.length) {\n this.logger.consoleFailure(`env: ${env.id}, task \"${taskId}\" has failed`);\n this.failedTasks.push(task);\n } else {\n const duration = prettyTime(process.hrtime(startTask));\n this.logger.consoleSuccess(`env \"${env.id}\", task \"${taskName}\" has completed successfully in ${duration}`);\n const defs = buildTaskResult.artifacts || [];\n artifacts = this.artifactFactory.generate(buildContext, defs, task);\n }\n\n const taskResults: TaskResults = {\n task,\n env,\n componentsResults: buildTaskResult.componentsResults,\n artifacts,\n startTime: taskStartTime,\n endTime,\n };\n\n this.taskResults.push(taskResults);\n }\n\n private async executePostBuild(tasksResults: TaskResultsList) {\n this.logger.setStatusLine('executing post-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.postBuild) return;\n await task.postBuild(this.getBuildContext(env.id), tasksResults);\n });\n this.logger.consoleSuccess();\n }\n\n private updateFailedDependencyTask(task: BuildTask) {\n if (!this.failedDependencyTask && this.failedTasks.length && task.dependencies) {\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeIdAllowEmptyName(dependency);\n this.failedDependencyTask = this.failedTasks.find((failedTask) => {\n if (name && name !== failedTask.name) return false;\n return aspectId === failedTask.aspectId;\n });\n });\n }\n }\n\n private shouldSkipTask(taskId: string, envId: string): boolean {\n if (!this.failedDependencyTask) return false;\n const failedTaskId = BuildTaskHelper.serializeId(this.failedDependencyTask);\n this.logger.consoleWarning(`env: ${envId}, task \"${taskId}\" has skipped due to \"${failedTaskId}\" failure`);\n return true;\n }\n\n private getBuildContext(envId: string) {\n const buildContext = this.envsBuildContext[envId];\n if (!buildContext) throw new Error(`unable to find buildContext for ${envId}`);\n buildContext.previousTasksResults = this.allTasksResults;\n return buildContext;\n }\n\n /**\n * create a build pipe from an array of tasks.\n */\n static from(\n tasksQueue: TasksQueue,\n envsBuildContext: EnvsBuildContext,\n logger: Logger,\n artifactFactory: ArtifactFactory,\n previousTaskResults?: TaskResults[]\n ) {\n return new BuildPipe(tasksQueue, envsBuildContext, logger, artifactFactory, previousTaskResults);\n }\n}\n"]}
@@ -184,10 +184,8 @@ function addDependenciesToGraph(graphs, pipeline, task) {
184
184
  const {
185
185
  aspectId,
186
186
  name
187
- } = dependency.includes(_buildTask().TaskIdDelimiter) ? _buildTask().BuildTaskHelper.deserializeId(dependency) : {
188
- aspectId: dependency,
189
- name: undefined
190
- };
187
+ } = _buildTask().BuildTaskHelper.deserializeIdAllowEmptyName(dependency);
188
+
191
189
  const dependencyTasks = pipeline.filter(pipelineTask => {
192
190
  if (pipelineTask.aspectId !== aspectId) return false;
193
191
  return name ? name === pipelineTask.name : true;
@@ -1 +1 @@
1
- {"version":3,"sources":["build-pipeline-order.ts"],"names":["calculatePipelineOrder","taskSlot","envs","pipeNameOnEnv","tasks","skipTests","graphs","locations","forEach","location","push","graph","Graph","pipelineEnvs","envDefinition","pipeline","getPipelineForEnv","env","flattenedPipeline","map","pipelineEnv","flat","task","addDependenciesToGraph","dataPerLocation","pipelineEnvsPerLocation","filter","tasksQueue","TasksQueue","addTasksToGraph","length","includes","name","aspectId","TesterAspect","id","data","find","d","sorted","toposort","taskNode","BuildTaskHelper","deserializeId","attr","taskIndex","findIndex","pipelineTask","splice","dependencies","taskId","serializeId","dependency","TaskIdDelimiter","undefined","dependencyTasks","Error","dependencyTask","getLocation","graphLocation","g","dependencyId","setNode","setEdge","taskLocation","dependencyLocation","isDependencyAhead","isDependencyEqual","buildTasks","slotsTasks","values","tasksAtStart","tasksAtEnd","mergedTasks"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,QADK,EAELC,IAFK,EAGLC,aAAa,GAAG,cAHX,EAILC,KAAe,GAAG,EAJb,EAKLC,SAAS,GAAG,KALP,EAMO;AACZ,QAAMC,MAA4B,GAAG,EAArC;AACA,QAAMC,SAAqB,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,KAApB,CAA9B,CAFY,CAE8C;;AAC1DA,EAAAA,SAAS,CAACC,OAAV,CAAmBC,QAAD,IAAc;AAC9BH,IAAAA,MAAM,CAACI,IAAP,CAAY;AAAED,MAAAA,QAAF;AAAYE,MAAAA,KAAK,EAAE,KAAIC,mBAAJ;AAAnB,KAAZ;AACD,GAF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GI,UAApC,CAApB;AAEA,SAAOC,WAAP;AACD","sourcesContent":["import { Graph } from 'cleargraph';\nimport TesterAspect from '@teambit/tester';\nimport { EnvDefinition, Environment } from '@teambit/envs';\nimport { BuildTask, BuildTaskHelper, TaskIdDelimiter } from './build-task';\nimport type { TaskSlot } from './builder.main.runtime';\nimport { TasksQueue } from './tasks-queue';\n\ntype TaskDependenciesGraph = Graph<string, string>;\ntype Location = 'start' | 'middle' | 'end';\ntype TasksLocationGraph = { location: Location; graph: TaskDependenciesGraph };\ntype PipelineEnv = { env: EnvDefinition; pipeline: BuildTask[] };\ntype DataPerLocation = { location: Location; graph: TaskDependenciesGraph; pipelineEnvs: PipelineEnv[] };\n\n/**\n * there are two ways how to add tasks to build pipeline.\n * 1. `getBuildPipe()` method of the env.\n * 2. registering to the `builder.registerBuildTask()`.\n *\n * in the option #1, it's possible to determine the order. e.g. `getBuildPipe() { return [taskA, taskB, taskC]; }`\n * in the option #2, the register happens once the extension is loaded, so there is no way to put\n * one task before/after another task.\n *\n * To be able to determine the order, you can do the following\n * 1. \"task.location\", it has two options \"start\" and \"end\". the rest are \"middle\".\n * 2. \"task.dependencies\", the dependencies must be completed for all envs before this task starts.\n * the dependencies are applicable inside a location and not across locations. see getLocation()\n * or/and continue reading for more info about this.\n *\n * to determine the final order of the tasks, the following is done:\n * 1. split all tasks to three groups: start, middle and end.\n * 2. for each group define a dependencies graph for the tasks with \"dependencies\" prop and the pipeline.\n * 3. start with the first group \"start\", toposort the dependencies graph and push the found tasks\n * to a queue. once completed, iterate the pipeline and add all tasks to the queue.\n * 4. do the same for the \"middle\" and \"end\" groups.\n *\n * the reason for splitting the tasks to the three groups and not using the \"dependencies\" field\n * alone to determine the order is that the \"start\" and \"end\" groups are mostly core and \"middle\"\n * is mostly the user entering tasks to the pipeline and we as the core don't know about the users\n * tasks. For example, a core task \"PublishComponent\" must happen after the compiler, however, a\n * user might have an env without a compiler. if we determine the order only by the dependencies\n * field, the \"PublishComponent\" would have a dependency \"compiler\" and because in this case there\n * is no compiler task, it would throw an error about missing dependencies.\n */\nexport function calculatePipelineOrder(\n taskSlot: TaskSlot,\n envs: EnvDefinition[],\n pipeNameOnEnv = 'getBuildPipe',\n tasks: string[] = [],\n skipTests = false\n): TasksQueue {\n const graphs: TasksLocationGraph[] = [];\n const locations: Location[] = ['start', 'middle', 'end']; // the order is important here!\n locations.forEach((location) => {\n graphs.push({ location, graph: new Graph<string, string>() });\n });\n const pipelineEnvs: PipelineEnv[] = [];\n envs.forEach((envDefinition) => {\n const pipeline = getPipelineForEnv(taskSlot, envDefinition.env, pipeNameOnEnv);\n pipelineEnvs.push({ env: envDefinition, pipeline });\n });\n\n const flattenedPipeline: BuildTask[] = pipelineEnvs.map((pipelineEnv) => pipelineEnv.pipeline).flat();\n flattenedPipeline.forEach((task) => addDependenciesToGraph(graphs, flattenedPipeline, task));\n\n const dataPerLocation: DataPerLocation[] = graphs.map(({ location, graph }) => {\n const pipelineEnvsPerLocation: PipelineEnv[] = pipelineEnvs.map(({ env, pipeline }) => {\n return { env, pipeline: pipeline.filter((task) => (task.location || 'middle') === location) };\n });\n return { location, graph, pipelineEnvs: pipelineEnvsPerLocation };\n });\n\n const tasksQueue = new TasksQueue();\n locations.forEach((location) => addTasksToGraph(tasksQueue, dataPerLocation, location));\n if (tasks.length) {\n return new TasksQueue(\n ...tasksQueue.filter(({ task }) => tasks.includes(task.name) || tasks.includes(task.aspectId))\n );\n }\n if (skipTests) {\n return new TasksQueue(...tasksQueue.filter(({ task }) => task.aspectId !== TesterAspect.id));\n }\n return tasksQueue;\n}\n\nfunction addTasksToGraph(tasksQueue: TasksQueue, dataPerLocation: DataPerLocation[], location: Location) {\n const data = dataPerLocation.find((d) => d.location === location);\n if (!data) return;\n const sorted = data.graph.toposort();\n sorted.forEach((taskNode) => {\n const { aspectId, name } = BuildTaskHelper.deserializeId(taskNode.attr);\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n const taskIndex = pipeline.findIndex(\n (pipelineTask) => pipelineTask.aspectId === aspectId && pipelineTask.name === name\n );\n if (taskIndex < 0) return;\n const task = pipeline[taskIndex];\n tasksQueue.push({ env, task });\n pipeline.splice(taskIndex, 1); // delete the task from the pipeline\n });\n });\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n pipeline.forEach((task) => tasksQueue.push({ env, task }));\n });\n}\n\nfunction addDependenciesToGraph(graphs: TasksLocationGraph[], pipeline: BuildTask[], task: BuildTask) {\n if (!task.dependencies || !task.dependencies.length) return;\n const taskId = BuildTaskHelper.serializeId(task);\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = dependency.includes(TaskIdDelimiter)\n ? BuildTaskHelper.deserializeId(dependency)\n : { aspectId: dependency, name: undefined };\n const dependencyTasks = pipeline.filter((pipelineTask) => {\n if (pipelineTask.aspectId !== aspectId) return false;\n return name ? name === pipelineTask.name : true;\n });\n if (dependencyTasks.length === 0) {\n throw new Error(\n `unable to find dependency \"${dependency}\" of \"${BuildTaskHelper.serializeId(task)}\" in the pipeline`\n );\n }\n dependencyTasks.forEach((dependencyTask) => {\n const location = getLocation(task, dependencyTask);\n if (!location) {\n // the dependency is behind and will be in the correct order regardless the graph.\n return;\n }\n const graphLocation = graphs.find((g) => g.location === location);\n if (!graphLocation) throw new Error(`unable to find graph for location ${location}`);\n const dependencyId = BuildTaskHelper.serializeId(dependencyTask);\n const graph = graphLocation.graph;\n graph.setNode(taskId, taskId);\n graph.setNode(dependencyId, dependencyId);\n graph.setEdge(dependencyId, taskId, 'dependency');\n });\n });\n}\n\n/**\n * since the task execution is happening per group: \"start\", \"middle\" and \"end\", the dependencies\n * need to be inside the same group.\n * e.g. if a dependency located at \"end\" group and the task located at \"start\", it's impossible to\n * complete the dependency before the task, there it throws an error.\n * it's ok to have the dependency located earlier, e.g. \"start\" and the task at \"end\", and in this\n * case, it will not be part of the graph because there is no need to do any special calculation.\n */\nfunction getLocation(task: BuildTask, dependencyTask: BuildTask): Location | null {\n const taskLocation = task.location || 'middle';\n const dependencyLocation = dependencyTask.location || 'middle';\n\n const isDependencyAhead =\n (taskLocation === 'start' && dependencyLocation !== 'start') ||\n (taskLocation === 'middle' && dependencyLocation === 'end');\n\n const isDependencyEqual = taskLocation === dependencyLocation;\n\n if (isDependencyAhead) {\n throw new Error(`a task \"${BuildTaskHelper.serializeId(task)}\" located at ${taskLocation}\nhas a dependency \"${BuildTaskHelper.serializeId(dependencyTask)} located at ${dependencyLocation},\nwhich is invalid. the dependency must be located earlier or in the same location as the task\"`);\n }\n\n if (isDependencyEqual) {\n return taskLocation;\n }\n\n // dependency is behind. e.g. task is \"end\" and dependency is \"start\". no need to enter to the\n // graph as it's going to be executed in the right order regardless the graph.\n return null;\n}\n\nfunction getPipelineForEnv(taskSlot: TaskSlot, env: Environment, pipeNameOnEnv: string): BuildTask[] {\n const buildTasks: BuildTask[] = env[pipeNameOnEnv] ? env[pipeNameOnEnv]() : [];\n const slotsTasks = taskSlot.values().flat();\n const tasksAtStart: BuildTask[] = [];\n const tasksAtEnd: BuildTask[] = [];\n slotsTasks.forEach((task) => {\n if (task.location === 'start') {\n tasksAtStart.push(task);\n return;\n }\n if (task.location === 'end') {\n tasksAtEnd.push(task);\n return;\n }\n tasksAtStart.push(task);\n });\n\n // merge with extension registered tasks.\n const mergedTasks = [...tasksAtStart, ...buildTasks, ...tasksAtEnd];\n\n return mergedTasks;\n}\n"]}
1
+ {"version":3,"sources":["build-pipeline-order.ts"],"names":["calculatePipelineOrder","taskSlot","envs","pipeNameOnEnv","tasks","skipTests","graphs","locations","forEach","location","push","graph","Graph","pipelineEnvs","envDefinition","pipeline","getPipelineForEnv","env","flattenedPipeline","map","pipelineEnv","flat","task","addDependenciesToGraph","dataPerLocation","pipelineEnvsPerLocation","filter","tasksQueue","TasksQueue","addTasksToGraph","length","includes","name","aspectId","TesterAspect","id","data","find","d","sorted","toposort","taskNode","BuildTaskHelper","deserializeId","attr","taskIndex","findIndex","pipelineTask","splice","dependencies","taskId","serializeId","dependency","deserializeIdAllowEmptyName","dependencyTasks","Error","dependencyTask","getLocation","graphLocation","g","dependencyId","setNode","setEdge","taskLocation","dependencyLocation","isDependencyAhead","isDependencyEqual","buildTasks","slotsTasks","values","tasksAtStart","tasksAtEnd","mergedTasks"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,QADK,EAELC,IAFK,EAGLC,aAAa,GAAG,cAHX,EAILC,KAAe,GAAG,EAJb,EAKLC,SAAS,GAAG,KALP,EAMO;AACZ,QAAMC,MAA4B,GAAG,EAArC;AACA,QAAMC,SAAqB,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,KAApB,CAA9B,CAFY,CAE8C;;AAC1DA,EAAAA,SAAS,CAACC,OAAV,CAAmBC,QAAD,IAAc;AAC9BH,IAAAA,MAAM,CAACI,IAAP,CAAY;AAAED,MAAAA,QAAF;AAAYE,MAAAA,KAAK,EAAE,KAAIC,mBAAJ;AAAnB,KAAZ;AACD,GAFD;AAGA,QAAMC,YAA2B,GAAG,EAApC;AACAX,EAAAA,IAAI,CAACM,OAAL,CAAcM,aAAD,IAAmB;AAC9B,UAAMC,QAAQ,GAAGC,iBAAiB,CAACf,QAAD,EAAWa,aAAa,CAACG,GAAzB,EAA8Bd,aAA9B,CAAlC;AACAU,IAAAA,YAAY,CAACH,IAAb,CAAkB;AAAEO,MAAAA,GAAG,EAAEH,aAAP;AAAsBC,MAAAA;AAAtB,KAAlB;AACD,GAHD;AAKA,QAAMG,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ACA,SAAO,IAAP;AACD;;AAED,SAAS/C,iBAAT,CAA2Bf,QAA3B,EAA+CgB,GAA/C,EAAiEd,aAAjE,EAAqG;AACnG,QAAMgE,UAAuB,GAAGlD,GAAG,CAACd,aAAD,CAAH,GAAqBc,GAAG,CAACd,aAAD,CAAH,EAArB,GAA4C,EAA5E;AACA,QAAMiE,UAAU,GAAGnE,QAAQ,CAACoE,MAAT,GAAkBhD,IAAlB,EAAnB;AACA,QAAMiD,YAAyB,GAAG,EAAlC;AACA,QAAMC,UAAuB,GAAG,EAAhC;AACAH,EAAAA,UAAU,CAAC5D,OAAX,CAAoBc,IAAD,IAAU;AAC3B,QAAIA,IAAI,CAACb,QAAL,KAAkB,OAAtB,EAA+B;AAC7B6D,MAAAA,YAAY,CAAC5D,IAAb,CAAkBY,IAAlB;AACA;AACD;;AACD,QAAIA,IAAI,CAACb,QAAL,KAAkB,KAAtB,EAA6B;AAC3B8D,MAAAA,UAAU,CAAC7D,IAAX,CAAgBY,IAAhB;AACA;AACD;;AACDgD,IAAAA,YAAY,CAAC5D,IAAb,CAAkBY,IAAlB;AACD,GAVD,EALmG,CAiBnG;;AACA,QAAMkD,WAAW,GAAG,CAAC,GAAGF,YAAJ,EAAkB,GAAGH,UAArB,EAAiC,GAAGI,UAApC,CAApB;AAEA,SAAOC,WAAP;AACD","sourcesContent":["import { Graph } from 'cleargraph';\nimport TesterAspect from '@teambit/tester';\nimport { EnvDefinition, Environment } from '@teambit/envs';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport type { TaskSlot } from './builder.main.runtime';\nimport { TasksQueue } from './tasks-queue';\n\ntype TaskDependenciesGraph = Graph<string, string>;\ntype Location = 'start' | 'middle' | 'end';\ntype TasksLocationGraph = { location: Location; graph: TaskDependenciesGraph };\ntype PipelineEnv = { env: EnvDefinition; pipeline: BuildTask[] };\ntype DataPerLocation = { location: Location; graph: TaskDependenciesGraph; pipelineEnvs: PipelineEnv[] };\n\n/**\n * there are two ways how to add tasks to build pipeline.\n * 1. `getBuildPipe()` method of the env.\n * 2. registering to the `builder.registerBuildTask()`.\n *\n * in the option #1, it's possible to determine the order. e.g. `getBuildPipe() { return [taskA, taskB, taskC]; }`\n * in the option #2, the register happens once the extension is loaded, so there is no way to put\n * one task before/after another task.\n *\n * To be able to determine the order, you can do the following\n * 1. \"task.location\", it has two options \"start\" and \"end\". the rest are \"middle\".\n * 2. \"task.dependencies\", the dependencies must be completed for all envs before this task starts.\n * the dependencies are applicable inside a location and not across locations. see getLocation()\n * or/and continue reading for more info about this.\n *\n * to determine the final order of the tasks, the following is done:\n * 1. split all tasks to three groups: start, middle and end.\n * 2. for each group define a dependencies graph for the tasks with \"dependencies\" prop and the pipeline.\n * 3. start with the first group \"start\", toposort the dependencies graph and push the found tasks\n * to a queue. once completed, iterate the pipeline and add all tasks to the queue.\n * 4. do the same for the \"middle\" and \"end\" groups.\n *\n * the reason for splitting the tasks to the three groups and not using the \"dependencies\" field\n * alone to determine the order is that the \"start\" and \"end\" groups are mostly core and \"middle\"\n * is mostly the user entering tasks to the pipeline and we as the core don't know about the users\n * tasks. For example, a core task \"PublishComponent\" must happen after the compiler, however, a\n * user might have an env without a compiler. if we determine the order only by the dependencies\n * field, the \"PublishComponent\" would have a dependency \"compiler\" and because in this case there\n * is no compiler task, it would throw an error about missing dependencies.\n */\nexport function calculatePipelineOrder(\n taskSlot: TaskSlot,\n envs: EnvDefinition[],\n pipeNameOnEnv = 'getBuildPipe',\n tasks: string[] = [],\n skipTests = false\n): TasksQueue {\n const graphs: TasksLocationGraph[] = [];\n const locations: Location[] = ['start', 'middle', 'end']; // the order is important here!\n locations.forEach((location) => {\n graphs.push({ location, graph: new Graph<string, string>() });\n });\n const pipelineEnvs: PipelineEnv[] = [];\n envs.forEach((envDefinition) => {\n const pipeline = getPipelineForEnv(taskSlot, envDefinition.env, pipeNameOnEnv);\n pipelineEnvs.push({ env: envDefinition, pipeline });\n });\n\n const flattenedPipeline: BuildTask[] = pipelineEnvs.map((pipelineEnv) => pipelineEnv.pipeline).flat();\n flattenedPipeline.forEach((task) => addDependenciesToGraph(graphs, flattenedPipeline, task));\n\n const dataPerLocation: DataPerLocation[] = graphs.map(({ location, graph }) => {\n const pipelineEnvsPerLocation: PipelineEnv[] = pipelineEnvs.map(({ env, pipeline }) => {\n return { env, pipeline: pipeline.filter((task) => (task.location || 'middle') === location) };\n });\n return { location, graph, pipelineEnvs: pipelineEnvsPerLocation };\n });\n\n const tasksQueue = new TasksQueue();\n locations.forEach((location) => addTasksToGraph(tasksQueue, dataPerLocation, location));\n if (tasks.length) {\n return new TasksQueue(\n ...tasksQueue.filter(({ task }) => tasks.includes(task.name) || tasks.includes(task.aspectId))\n );\n }\n if (skipTests) {\n return new TasksQueue(...tasksQueue.filter(({ task }) => task.aspectId !== TesterAspect.id));\n }\n return tasksQueue;\n}\n\nfunction addTasksToGraph(tasksQueue: TasksQueue, dataPerLocation: DataPerLocation[], location: Location) {\n const data = dataPerLocation.find((d) => d.location === location);\n if (!data) return;\n const sorted = data.graph.toposort();\n sorted.forEach((taskNode) => {\n const { aspectId, name } = BuildTaskHelper.deserializeId(taskNode.attr);\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n const taskIndex = pipeline.findIndex(\n (pipelineTask) => pipelineTask.aspectId === aspectId && pipelineTask.name === name\n );\n if (taskIndex < 0) return;\n const task = pipeline[taskIndex];\n tasksQueue.push({ env, task });\n pipeline.splice(taskIndex, 1); // delete the task from the pipeline\n });\n });\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n pipeline.forEach((task) => tasksQueue.push({ env, task }));\n });\n}\n\nfunction addDependenciesToGraph(graphs: TasksLocationGraph[], pipeline: BuildTask[], task: BuildTask) {\n if (!task.dependencies || !task.dependencies.length) return;\n const taskId = BuildTaskHelper.serializeId(task);\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeIdAllowEmptyName(dependency);\n const dependencyTasks = pipeline.filter((pipelineTask) => {\n if (pipelineTask.aspectId !== aspectId) return false;\n return name ? name === pipelineTask.name : true;\n });\n if (dependencyTasks.length === 0) {\n throw new Error(\n `unable to find dependency \"${dependency}\" of \"${BuildTaskHelper.serializeId(task)}\" in the pipeline`\n );\n }\n dependencyTasks.forEach((dependencyTask) => {\n const location = getLocation(task, dependencyTask);\n if (!location) {\n // the dependency is behind and will be in the correct order regardless the graph.\n return;\n }\n const graphLocation = graphs.find((g) => g.location === location);\n if (!graphLocation) throw new Error(`unable to find graph for location ${location}`);\n const dependencyId = BuildTaskHelper.serializeId(dependencyTask);\n const graph = graphLocation.graph;\n graph.setNode(taskId, taskId);\n graph.setNode(dependencyId, dependencyId);\n graph.setEdge(dependencyId, taskId, 'dependency');\n });\n });\n}\n\n/**\n * since the task execution is happening per group: \"start\", \"middle\" and \"end\", the dependencies\n * need to be inside the same group.\n * e.g. if a dependency located at \"end\" group and the task located at \"start\", it's impossible to\n * complete the dependency before the task, there it throws an error.\n * it's ok to have the dependency located earlier, e.g. \"start\" and the task at \"end\", and in this\n * case, it will not be part of the graph because there is no need to do any special calculation.\n */\nfunction getLocation(task: BuildTask, dependencyTask: BuildTask): Location | null {\n const taskLocation = task.location || 'middle';\n const dependencyLocation = dependencyTask.location || 'middle';\n\n const isDependencyAhead =\n (taskLocation === 'start' && dependencyLocation !== 'start') ||\n (taskLocation === 'middle' && dependencyLocation === 'end');\n\n const isDependencyEqual = taskLocation === dependencyLocation;\n\n if (isDependencyAhead) {\n throw new Error(`a task \"${BuildTaskHelper.serializeId(task)}\" located at ${taskLocation}\nhas a dependency \"${BuildTaskHelper.serializeId(dependencyTask)} located at ${dependencyLocation},\nwhich is invalid. the dependency must be located earlier or in the same location as the task\"`);\n }\n\n if (isDependencyEqual) {\n return taskLocation;\n }\n\n // dependency is behind. e.g. task is \"end\" and dependency is \"start\". no need to enter to the\n // graph as it's going to be executed in the right order regardless the graph.\n return null;\n}\n\nfunction getPipelineForEnv(taskSlot: TaskSlot, env: Environment, pipeNameOnEnv: string): BuildTask[] {\n const buildTasks: BuildTask[] = env[pipeNameOnEnv] ? env[pipeNameOnEnv]() : [];\n const slotsTasks = taskSlot.values().flat();\n const tasksAtStart: BuildTask[] = [];\n const tasksAtEnd: BuildTask[] = [];\n slotsTasks.forEach((task) => {\n if (task.location === 'start') {\n tasksAtStart.push(task);\n return;\n }\n if (task.location === 'end') {\n tasksAtEnd.push(task);\n return;\n }\n tasksAtStart.push(task);\n });\n\n // merge with extension registered tasks.\n const mergedTasks = [...tasksAtStart, ...buildTasks, ...tasksAtEnd];\n\n return mergedTasks;\n}\n"]}
@@ -101,4 +101,12 @@ export declare class BuildTaskHelper {
101
101
  aspectId: string;
102
102
  name: string;
103
103
  };
104
+ /**
105
+ * don't throw an error when the id includes only the aspect-id without the task name.
106
+ * useful for task dependencies, when it's allowed to specify the aspect-id only.
107
+ */
108
+ static deserializeIdAllowEmptyName(id: string): {
109
+ aspectId: string;
110
+ name?: string;
111
+ };
104
112
  }
@@ -38,6 +38,18 @@ class BuildTaskHelper {
38
38
  };
39
39
  throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);
40
40
  }
41
+ /**
42
+ * don't throw an error when the id includes only the aspect-id without the task name.
43
+ * useful for task dependencies, when it's allowed to specify the aspect-id only.
44
+ */
45
+
46
+
47
+ static deserializeIdAllowEmptyName(id) {
48
+ return id.includes(TaskIdDelimiter) ? BuildTaskHelper.deserializeId(id) : {
49
+ aspectId: id,
50
+ name: undefined
51
+ };
52
+ }
41
53
 
42
54
  }
43
55
 
@@ -1 +1 @@
1
- {"version":3,"sources":["build-task.ts"],"names":["TaskIdDelimiter","CAPSULE_ARTIFACTS_DIR","BuildTaskHelper","serializeId","aspectId","name","deserializeId","id","split","length","Error"],"mappings":";;;;;;;;;AAUA;AACA;AACA;AACO,MAAMA,eAAe,GAAG,GAAxB;AAEP;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,WAA9B;;;AA8FA,MAAMC,eAAN,CAAsB;AACT,SAAXC,WAAW,CAAC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAD,EAAiE;AACjF,WAAOD,QAAQ,GAAGJ,eAAX,GAA6BK,IAApC;AACD;;AACmB,SAAbC,aAAa,CAACC,EAAD,EAAiD;AACnE,UAAMC,KAAK,GAAGD,EAAE,CAACC,KAAH,CAASR,eAAT,CAAd;AACA,QAAIQ,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,MAAM,IAAIC,KAAJ,CAAW,kBAAiBH,EAAG,WAA/B,CAAN;AACxB,QAAIC,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,MAAM,IAAIC,KAAJ,CAAW,kBAAiBH,EAAG,kCAA/B,CAAN;AACxB,QAAIC,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,OAAO;AAAEL,MAAAA,QAAQ,EAAEI,KAAK,CAAC,CAAD,CAAjB;AAAsBH,MAAAA,IAAI,EAAEG,KAAK,CAAC,CAAD;AAAjC,KAAP;AACxB,UAAM,IAAIE,KAAJ,CAAW,qBAAoBH,EAAG,sBAAqBP,eAAgB,EAAvE,CAAN;AACD;;AAV0B","sourcesContent":["import type { Component } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport type { Network } from '@teambit/isolator';\nimport type { ComponentResult } from './types';\nimport type { ArtifactDefinition } from './artifact';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskResults } from './build-pipe';\n\nexport type TaskLocation = 'start' | 'end';\n\n/**\n * delimiter between task.aspectId and task.name\n */\nexport const TaskIdDelimiter = ':';\n\n/**\n * A folder to write artifacts generated during a build task\n * This folder is used in the core envs and excluded by default from the package tar file (the core envs is writing this into the npmignore file)\n */\nexport const CAPSULE_ARTIFACTS_DIR = 'artifacts';\n\nexport interface BuildContext extends ExecutionContext {\n /**\n * all components about to be built/tagged.\n */\n components: Component[];\n\n /**\n * network of capsules ready to be built.\n */\n capsuleNetwork: Network;\n\n /**\n * data generated by tasks that were running before this task\n */\n previousTasksResults: TaskResults[];\n\n /**\n * Run the build pipeline in dev mode\n */\n dev?: boolean;\n}\n\nexport interface BuildTask {\n /**\n * aspect id serialized of the creator of the task.\n * todo: automate this so then it won't be needed to pass manually.\n */\n aspectId: string;\n\n /**\n * name of the task. function as an identifier among other tasks of the same aspectId.\n * spaces and special characters are not allowed. as a convention, use UpperCamelCase style.\n * (e.g. TypescriptCompiler).\n */\n name: string;\n\n /**\n * description of what the task does.\n * if available, the logger will log it show it in the status-line.\n */\n description?: string;\n\n /**\n * where to put the task, before the env pipeline or after\n */\n location?: TaskLocation;\n\n /**\n * execute a task in a build context\n */\n execute(context: BuildContext): Promise<BuiltTaskResult>;\n\n /**\n * run before the build pipeline has started. this is useful when some preparation are needed to\n * be done on all envs before the build starts.\n * e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will\n * cause dependencies from other envs to get this tsconfig written.\n */\n preBuild?(context: BuildContext): Promise<void>;\n\n /**\n * run after the build pipeline completed for all envs. useful for doing some cleanup on the\n * capsules before the deployment starts.\n */\n postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;\n\n /**\n * needed if you want the task to be running only after the dependencies were completed\n * for *all* envs.\n * normally this is not needed because the build-pipeline runs the tasks in the same order\n * they're located in the `getBuildPipe()` array and according to the task.location.\n * the case where this is useful is when a task not only needs to be after another task, but also\n * after all environments were running that task.\n * a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use\n * \"aspectId:name\", e.g. \"teambit.compilation/compiler:TypescriptCompiler\".\n */\n dependencies?: string[];\n}\n\n// TODO: rename to BuildTaskResults\nexport interface BuiltTaskResult {\n /**\n * build results for each of the components in the build context.\n */\n componentsResults: ComponentResult[];\n\n /**\n * array of artifact definitions to generate after a successful build.\n */\n artifacts?: ArtifactDefinition[];\n}\n\nexport class BuildTaskHelper {\n static serializeId({ aspectId, name }: { aspectId: string; name: string }): string {\n return aspectId + TaskIdDelimiter + name;\n }\n static deserializeId(id: string): { aspectId: string; name: string } {\n const split = id.split(TaskIdDelimiter);\n if (split.length === 0) throw new Error(`deserializeId, ${id} is empty`);\n if (split.length === 1) throw new Error(`deserializeId, ${id} has only aspect-id without name`);\n if (split.length === 2) return { aspectId: split[0], name: split[1] };\n throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);\n }\n}\n"]}
1
+ {"version":3,"sources":["build-task.ts"],"names":["TaskIdDelimiter","CAPSULE_ARTIFACTS_DIR","BuildTaskHelper","serializeId","aspectId","name","deserializeId","id","split","length","Error","deserializeIdAllowEmptyName","includes","undefined"],"mappings":";;;;;;;;;AAUA;AACA;AACA;AACO,MAAMA,eAAe,GAAG,GAAxB;AAEP;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAAG,WAA9B;;;AA8FA,MAAMC,eAAN,CAAsB;AACT,SAAXC,WAAW,CAAC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAD,EAAiE;AACjF,WAAOD,QAAQ,GAAGJ,eAAX,GAA6BK,IAApC;AACD;;AACmB,SAAbC,aAAa,CAACC,EAAD,EAAiD;AACnE,UAAMC,KAAK,GAAGD,EAAE,CAACC,KAAH,CAASR,eAAT,CAAd;AACA,QAAIQ,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,MAAM,IAAIC,KAAJ,CAAW,kBAAiBH,EAAG,WAA/B,CAAN;AACxB,QAAIC,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,MAAM,IAAIC,KAAJ,CAAW,kBAAiBH,EAAG,kCAA/B,CAAN;AACxB,QAAIC,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,OAAO;AAAEL,MAAAA,QAAQ,EAAEI,KAAK,CAAC,CAAD,CAAjB;AAAsBH,MAAAA,IAAI,EAAEG,KAAK,CAAC,CAAD;AAAjC,KAAP;AACxB,UAAM,IAAIE,KAAJ,CAAW,qBAAoBH,EAAG,sBAAqBP,eAAgB,EAAvE,CAAN;AACD;AACD;AACF;AACA;AACA;;;AACoC,SAA3BW,2BAA2B,CAACJ,EAAD,EAAkD;AAClF,WAAOA,EAAE,CAACK,QAAH,CAAYZ,eAAZ,IAA+BE,eAAe,CAACI,aAAhB,CAA8BC,EAA9B,CAA/B,GAAmE;AAAEH,MAAAA,QAAQ,EAAEG,EAAZ;AAAgBF,MAAAA,IAAI,EAAEQ;AAAtB,KAA1E;AACD;;AAjB0B","sourcesContent":["import type { Component } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport type { Network } from '@teambit/isolator';\nimport type { ComponentResult } from './types';\nimport type { ArtifactDefinition } from './artifact';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskResults } from './build-pipe';\n\nexport type TaskLocation = 'start' | 'end';\n\n/**\n * delimiter between task.aspectId and task.name\n */\nexport const TaskIdDelimiter = ':';\n\n/**\n * A folder to write artifacts generated during a build task\n * This folder is used in the core envs and excluded by default from the package tar file (the core envs is writing this into the npmignore file)\n */\nexport const CAPSULE_ARTIFACTS_DIR = 'artifacts';\n\nexport interface BuildContext extends ExecutionContext {\n /**\n * all components about to be built/tagged.\n */\n components: Component[];\n\n /**\n * network of capsules ready to be built.\n */\n capsuleNetwork: Network;\n\n /**\n * data generated by tasks that were running before this task\n */\n previousTasksResults: TaskResults[];\n\n /**\n * Run the build pipeline in dev mode\n */\n dev?: boolean;\n}\n\nexport interface BuildTask {\n /**\n * aspect id serialized of the creator of the task.\n * todo: automate this so then it won't be needed to pass manually.\n */\n aspectId: string;\n\n /**\n * name of the task. function as an identifier among other tasks of the same aspectId.\n * spaces and special characters are not allowed. as a convention, use UpperCamelCase style.\n * (e.g. TypescriptCompiler).\n */\n name: string;\n\n /**\n * description of what the task does.\n * if available, the logger will log it show it in the status-line.\n */\n description?: string;\n\n /**\n * where to put the task, before the env pipeline or after\n */\n location?: TaskLocation;\n\n /**\n * execute a task in a build context\n */\n execute(context: BuildContext): Promise<BuiltTaskResult>;\n\n /**\n * run before the build pipeline has started. this is useful when some preparation are needed to\n * be done on all envs before the build starts.\n * e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will\n * cause dependencies from other envs to get this tsconfig written.\n */\n preBuild?(context: BuildContext): Promise<void>;\n\n /**\n * run after the build pipeline completed for all envs. useful for doing some cleanup on the\n * capsules before the deployment starts.\n */\n postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;\n\n /**\n * needed if you want the task to be running only after the dependencies were completed\n * for *all* envs.\n * normally this is not needed because the build-pipeline runs the tasks in the same order\n * they're located in the `getBuildPipe()` array and according to the task.location.\n * the case where this is useful is when a task not only needs to be after another task, but also\n * after all environments were running that task.\n * a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use\n * \"aspectId:name\", e.g. \"teambit.compilation/compiler:TypescriptCompiler\".\n */\n dependencies?: string[];\n}\n\n// TODO: rename to BuildTaskResults\nexport interface BuiltTaskResult {\n /**\n * build results for each of the components in the build context.\n */\n componentsResults: ComponentResult[];\n\n /**\n * array of artifact definitions to generate after a successful build.\n */\n artifacts?: ArtifactDefinition[];\n}\n\nexport class BuildTaskHelper {\n static serializeId({ aspectId, name }: { aspectId: string; name: string }): string {\n return aspectId + TaskIdDelimiter + name;\n }\n static deserializeId(id: string): { aspectId: string; name: string } {\n const split = id.split(TaskIdDelimiter);\n if (split.length === 0) throw new Error(`deserializeId, ${id} is empty`);\n if (split.length === 1) throw new Error(`deserializeId, ${id} has only aspect-id without name`);\n if (split.length === 2) return { aspectId: split[0], name: split[1] };\n throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);\n }\n /**\n * don't throw an error when the id includes only the aspect-id without the task name.\n * useful for task dependencies, when it's allowed to specify the aspect-id only.\n */\n static deserializeIdAllowEmptyName(id: string): { aspectId: string; name?: string } {\n return id.includes(TaskIdDelimiter) ? BuildTaskHelper.deserializeId(id) : { aspectId: id, name: undefined };\n }\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/builder",
3
- "version": "0.0.636",
3
+ "version": "0.0.640",
4
4
  "homepage": "https://bit.dev/teambit/pipelines/builder",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.pipelines",
8
8
  "name": "builder",
9
- "version": "0.0.636"
9
+ "version": "0.0.640"
10
10
  },
11
11
  "dependencies": {
12
12
  "p-map-series": "2.1.0",
@@ -22,17 +22,17 @@
22
22
  "globby": "11.0.1",
23
23
  "@babel/runtime": "7.12.18",
24
24
  "core-js": "^3.0.0",
25
- "@teambit/component": "0.0.636",
26
- "@teambit/envs": "0.0.636",
27
- "@teambit/logger": "0.0.524",
28
- "@teambit/tester": "0.0.636",
29
- "@teambit/isolator": "0.0.636",
30
- "@teambit/cli": "0.0.434",
31
- "@teambit/workspace": "0.0.636",
32
- "@teambit/aspect-loader": "0.0.636",
33
- "@teambit/generator": "0.0.636",
34
- "@teambit/graphql": "0.0.636",
35
- "@teambit/scope": "0.0.636",
25
+ "@teambit/component": "0.0.640",
26
+ "@teambit/envs": "0.0.640",
27
+ "@teambit/logger": "0.0.527",
28
+ "@teambit/tester": "0.0.640",
29
+ "@teambit/isolator": "0.0.640",
30
+ "@teambit/cli": "0.0.437",
31
+ "@teambit/workspace": "0.0.640",
32
+ "@teambit/aspect-loader": "0.0.640",
33
+ "@teambit/generator": "0.0.640",
34
+ "@teambit/graphql": "0.0.640",
35
+ "@teambit/scope": "0.0.640",
36
36
  "@teambit/bit-error": "0.0.394",
37
37
  "@teambit/component-id": "0.0.400"
38
38
  },
@@ -49,7 +49,7 @@
49
49
  "@teambit/pipelines.aspect-docs.builder": "0.0.131"
50
50
  },
51
51
  "peerDependencies": {
52
- "@teambit/legacy": "1.0.210",
52
+ "@teambit/legacy": "1.0.213",
53
53
  "react-dom": "^16.8.0 || ^17.0.0",
54
54
  "react": "^16.8.0 || ^17.0.0"
55
55
  },
@@ -77,7 +77,7 @@
77
77
  "react": "-"
78
78
  },
79
79
  "peerDependencies": {
80
- "@teambit/legacy": "1.0.210",
80
+ "@teambit/legacy": "1.0.213",
81
81
  "react-dom": "^16.8.0 || ^17.0.0",
82
82
  "react": "^16.8.0 || ^17.0.0"
83
83
  }