@teambit/builder 0.0.636 → 0.0.637

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.637/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.safeDeserializeId(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;AAAA;AA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,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","safeDeserializeId","find","failedTask","envId","failedTaskId","consoleWarning","Error","previousTasksResults","from"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAAA;;AA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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.safeDeserializeId(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"]}
@@ -101,4 +101,13 @@ export declare class BuildTaskHelper {
101
101
  aspectId: string;
102
102
  name: string;
103
103
  };
104
+ /**
105
+ * Deserialize the id, but without throw an error in case something is missing
106
+ * @param id
107
+ * @returns
108
+ */
109
+ static safeDeserializeId(id: string): {
110
+ aspectId?: string;
111
+ name?: string;
112
+ };
104
113
  }
@@ -38,6 +38,25 @@ class BuildTaskHelper {
38
38
  };
39
39
  throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);
40
40
  }
41
+ /**
42
+ * Deserialize the id, but without throw an error in case something is missing
43
+ * @param id
44
+ * @returns
45
+ */
46
+
47
+
48
+ static safeDeserializeId(id) {
49
+ const split = id.split(TaskIdDelimiter);
50
+ if (split.length === 0) return {};
51
+ if (split.length === 1) return {
52
+ aspectId: split[0]
53
+ };
54
+ if (split.length === 2) return {
55
+ aspectId: split[0],
56
+ name: split[1]
57
+ };
58
+ throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);
59
+ }
41
60
 
42
61
  }
43
62
 
@@ -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","safeDeserializeId"],"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;AACA;;;AAC0B,SAAjBW,iBAAiB,CAACJ,EAAD,EAAmD;AACzE,UAAMC,KAAK,GAAGD,EAAE,CAACC,KAAH,CAASR,eAAT,CAAd;AACA,QAAIQ,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,OAAO,EAAP;AACxB,QAAID,KAAK,CAACC,MAAN,KAAiB,CAArB,EAAwB,OAAO;AAAEL,MAAAA,QAAQ,EAAEI,KAAK,CAAC,CAAD;AAAjB,KAAP;AACxB,QAAIA,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;;AAtB0B","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 * Deserialize the id, but without throw an error in case something is missing\n * @param id\n * @returns\n */\n static safeDeserializeId(id: string): { aspectId?: string; name?: string } {\n const split = id.split(TaskIdDelimiter);\n if (split.length === 0) return {};\n if (split.length === 1) return { aspectId: split[0] };\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"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/builder",
3
- "version": "0.0.636",
3
+ "version": "0.0.637",
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.637"
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",
25
+ "@teambit/component": "0.0.637",
26
+ "@teambit/envs": "0.0.637",
27
27
  "@teambit/logger": "0.0.524",
28
- "@teambit/tester": "0.0.636",
29
- "@teambit/isolator": "0.0.636",
28
+ "@teambit/tester": "0.0.637",
29
+ "@teambit/isolator": "0.0.637",
30
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",
31
+ "@teambit/workspace": "0.0.637",
32
+ "@teambit/aspect-loader": "0.0.637",
33
+ "@teambit/generator": "0.0.637",
34
+ "@teambit/graphql": "0.0.637",
35
+ "@teambit/scope": "0.0.637",
36
36
  "@teambit/bit-error": "0.0.394",
37
37
  "@teambit/component-id": "0.0.400"
38
38
  },