@teambit/builder 1.0.269 → 1.0.271

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.
@@ -4,6 +4,7 @@ import { flatten } from 'lodash';
4
4
  import { ArtifactFiles } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';
5
5
  import { Component, ComponentMap } from '@teambit/component';
6
6
  import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';
7
+ import { PathLinux } from '@teambit/legacy/dist/utils/path';
7
8
  import { ArtifactDefinition } from './artifact-definition';
8
9
  import { DefaultResolver } from '../storage';
9
10
  import { ArtifactList } from './artifact-list';
@@ -18,7 +19,7 @@ export type ArtifactMap = ComponentMap<ArtifactList<FsArtifact>>;
18
19
  export class ArtifactFactory {
19
20
  resolvePaths(root: string, def: ArtifactDefinition): string[] {
20
21
  const patternsFlattened = flatten(def.globPatterns);
21
- const patternsFlattenedLinux = patternsFlattened.map(pathNormalizeToLinux);
22
+ const patternsFlattenedLinux: PathLinux[] = patternsFlattened.map(pathNormalizeToLinux);
22
23
  const paths = globby.sync(patternsFlattenedLinux, { cwd: root });
23
24
  return paths;
24
25
  }
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.pipelines/builder@1.0.269" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.pipelines/builder@1.0.271" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.pipelines/builder-preview"]=n():e["teambit.pipelines/builder-preview"]=n()}(self,(()=>(()=>{"use strict";var e={51935:(e,n,t)=>{var i={id:"teambit.pipelines/aspect-docs/builder@0.0.168",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,o(t(41594));var a=t(5016),r=["components"];function o(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},s.apply(this,arguments)}function l(e,n){if(null==e)return{};var t,i,a=d(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function d(e,n){if(null==e)return{};var t,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||(a[t]=e[t]);return a}o.__bit_component=i,s.__bit_component=i,l.__bit_component=i,d.__bit_component=i;var p={},m="wrapper";function u(e){var n=e.components,t=l(e,r);return(0,a.mdx)(m,s({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.mdx)("h2",null,"Background"),(0,a.mdx)("p",null,"Bit's build process is an extensible CI for independent components. It validates a component is not dependent on its context (the workspace), tests it, and generates all artifacts necessary for it to be viewed and consumed as an independent module (its distributable code, bundled preview, etc.)."),(0,a.mdx)("p",null,"The Build Pipeline is an Environment Service responsible for sequencing and executing a component's Build Tasks. As mentioned earlier, these tasks are performed on a component only after it's been isolated from the rest of the workspace."),(0,a.mdx)("p",null,"A component's default series of Build Tasks is composed of tasks set by Bit and by its environment."),(0,a.mdx)("h2",null,"Isolated builds"),(0,a.mdx)("p",null,"Components authored in a Bit workspace are created to be completely portable, and thus independent. To address that, the build process starts by creating a component 'capsule' which is an isolated instance of a component, generated in a separate directory in your filesystem."),(0,a.mdx)("p",null,'As part of the capsule creation, all packages listed as dependencies of that component will be installed. This step is necessary to validate there are no dependency-graph issues (a component that is not totally isolated will be able to use packages installed in parent directories in your workspace, by other components. This will translate into a "false positive" result when testing for dependency-graph issues in a non-isolated location).'),(0,a.mdx)("h2",null,"Incremental builds"),(0,a.mdx)("p",null,'When a component "goes through" the build pipeline, all of its dependencies are built as well. If a dependency has not changed since its last build, the build process will use its artifacts from the previous build (and will not process it again). This optimization to the build process supplements the "innate optimization" that naturally comes from developing (and building) independent components instead of a single monolithic codebase.'),(0,a.mdx)("h2",null,"Environment-specific builds"),(0,a.mdx)("p",null,"Each Bit environment determines its own build pipeline. That means, a single workspace that uses multiple environments will run a different set of build tasks on different components depending on their associated environment. This is another Bit feature that enables seamless transitioning between different development environments, all in the same workspace. It also makes it much easier to integrate the Build Pipeline in your (remote) CI, as it only requires executing the build step - all other per-component build configurations are already set by the various environments being used."),(0,a.mdx)("p",null,"Since environments are extensible, so are the build pipelines configured by them."),(0,a.mdx)("h2",null,"Build task"),(0,a.mdx)("p",null,"An example of a build-task is ",(0,a.mdx)("inlineCode",{parentName:"p"},"compile"),", it's written in the compiler aspect and is running on each one of the capsules created by the build process. build-tasks in many cases generate artifacts, in this case, the compiler generates ",(0,a.mdx)("inlineCode",{parentName:"p"},"dists")," files and write them on the isolated capsules. There artifacts files are used later for example when creating packages."),(0,a.mdx)("h2",null,"Pipelines"),(0,a.mdx)("p",null,"There are three pipelines: ",(0,a.mdx)("inlineCode",{parentName:"p"},"build"),", ",(0,a.mdx)("inlineCode",{parentName:"p"},"tag")," and ",(0,a.mdx)("inlineCode",{parentName:"p"},"snap"),"."),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit build")," runs the build pipeline."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit tag")," runs the build pipeline and then the tag pipeline."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit snap")," runs the build pipeline and then the snap pipeline.")),(0,a.mdx)("h2",null,"List Build Tasks"),(0,a.mdx)("p",null,"To get a list of all the tasks that will be running per pipeline on a specific component, run ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit build --list-tasks <id>"),".\nHere is an example of the relevant part from the output:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"➜ bit build --list-tasks ui/tooltip\nTasks List\nid: teambit.design/ui/tooltip@0.0.347\nenvId: teambit.react/react\n\nBuild Pipeline Tasks:\nteambit.harmony/aspect:CoreExporter\nteambit.compilation/compiler:TSCompiler\nteambit.defender/tester:TestComponents\nteambit.pkg/pkg:PreparePackages\nteambit.pkg/pkg:PublishDryRun\nteambit.preview/preview:GeneratePreview\n\nTag Pipeline Tasks:\nteambit.harmony/application:build_ui_application\nteambit.pkg/pkg:PublishComponents\n\nSnap Pipeline Tasks:\n<N/A>\n")),(0,a.mdx)("h2",null,"Implementing Build Tasks"),(0,a.mdx)("p",null,"The ",(0,a.mdx)("inlineCode",{parentName:"p"},"BuildTask")," interface is a good start to understand how to implement a new build-task.\nWhen writing a build task, the ",(0,a.mdx)("inlineCode",{parentName:"p"},"Network")," object is passed and it includes the seeders capsules, as well as the entire graph including the dependencies.\nKeep in mind that the entire graph may contain components from other envs."),(0,a.mdx)("p",null,"Some tasks, such as, compiling in typescript and bundling with Webpack, need the entire graph.\nOthers, such as, Babel, need only the seeders. However, normally, the bundling is running after the compilation and it expects to have the dependencies compiled, so you might need the entire graph regardless."),(0,a.mdx)("h2",null,"Adding Tasks to a pipeline"),(0,a.mdx)("p",null,"There are two ways of adding tasks to the build pipeline."),(0,a.mdx)("ol",null,(0,a.mdx)("li",{parentName:"ol"},(0,a.mdx)("inlineCode",{parentName:"li"},"getBuildPipe()")," method of the env. (or ",(0,a.mdx)("inlineCode",{parentName:"li"},"getTagPipe()")," and ",(0,a.mdx)("inlineCode",{parentName:"li"},"getSnapPipe()"),")"),(0,a.mdx)("li",{parentName:"ol"},"registering to the slot via ",(0,a.mdx)("inlineCode",{parentName:"li"},"builder.registerBuildTask()"),". (or ",(0,a.mdx)("inlineCode",{parentName:"li"},"registerTagTask()")," and ",(0,a.mdx)("inlineCode",{parentName:"li"},"registerSnapTask()"),")")),(0,a.mdx)("p",null,"in the option #1, it's possible to determine the order. e.g. ",(0,a.mdx)("inlineCode",{parentName:"p"},"getBuildPipe() { return [taskA, taskB, taskC]; }"),"\nin the option #2, the register happens once the extension is loaded, so there is no way to put\none task before/after another task as of now."),(0,a.mdx)("h2",null,"Sequencing the build tasks"),(0,a.mdx)("p",null,"The Build Pipeline takes into consideration the following factors when deciding the order of which to execute each task:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("strong",{parentName:"li"},"Location"),": A task can be executed either at the start or end of the build pipeline. This can be explicitly configured by the task itself."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("strong",{parentName:"li"},"Dependencies"),": A task can depend on other tasks. That means, the dependencies must be completed successfully for all envs before this task starts. The dependencies are applicable inside a location and not across locations. This is configured by the task itself."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("strong",{parentName:"li"},"An environment's list of build tasks"),": This is the array of tasks as it is defined by an environment")),(0,a.mdx)("h2",null,"Executing the pipelines"),(0,a.mdx)("p",null,"Commands that trigger the build pipeline:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit build")," - runs the build pipeline on your local machine, for the entire workspace. The output data will not persist. - That is most often used for testing and debugging the build process."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit tag")," - runs the tag pipeline in addition to the build pipeline, before creating a new component release version. The output data will persist."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit snap")," - runs the snap pipeline in addition to the build pipeline. The output data will persist.")),(0,a.mdx)("p",null,"Build pipelines are determined by the environments in use. That means, in order to override the default pipeline, we need to create a new environment extension or modify an existing one."),(0,a.mdx)("p",null,"The example task below, shown being used by a customized environment, prints out the component name of every component handled by it. In addition to that, the task returns the component name as custom metadata to be logged and/or stored in the component tagged version. ",(0,a.mdx)("a",{parentName:"p",href:"https://github.com/teambit/harmony-build-examples"},"See a demo project here"),"."),(0,a.mdx)("blockquote",null,(0,a.mdx)("p",{parentName:"blockquote"},"Information returned by a build task will only persist if the build-pipeline was triggered by the 'hard-tag' command (",(0,a.mdx)("inlineCode",{parentName:"p"},"bit tag <component-id>"),").")),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="print-cmp-name-task.ts"',title:'"print-cmp-name-task.ts"'},"import { BuildTask, BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\n\n// A task is an implementation of 'BuildTask' provided by the 'builder' aspect\nexport class PrintCmpNameTask implements BuildTask {\n // The constructor leaves these properties up to the hands of the environment using this task\n constructor(readonly aspectId: string, readonly name: string) {}\n\n // This is where the task logic is placed. It will be executed by the build pipeline\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const componentsResults: ComponentResult[] = [];\n\n // Go through every isolated component instance\n context.capsuleNetwork.seedersCapsules.forEach((capsule) => {\n console.log(`The current component name is: ${capsule.component.id.name}`);\n\n componentsResults.push({\n component: capsule.component,\n metadata: { customProp: capsule.component.id.name },\n });\n });\n return {\n // An array of component objects, enriched with additional data produced by the task\n componentsResults,\n };\n }\n}\n")),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="customized-react.extension.ts"',title:'"customized-react.extension.ts"'},"import { EnvsMain, EnvsAspect } from '@teambit/envs';\nimport { ReactAspect, ReactMain } from '@teambit/react';\n\n// Import the task\nimport { PrintCmpNameTask } from './print-cmp-name-task';\n\nexport class CustomReact {\n constructor(private react: ReactMain) {}\n\n static dependencies: any = [EnvsAspect, ReactAspect];\n\n static async provider([envs, react]: [EnvsMain, ReactMain]) {\n // Get the environment's default build pipeline\n const reactPipe = react.env.getBuildPipe();\n\n // Add the custom task to the end of the build tasks sequence.\n // Provide the task with the component ID of the extension using it.\n // Provide the ask with a name.\n const tasks = [...reactPipe, new PrintCompTask('extensions/custom-react', 'PrintCmpNameTask')];\n\n // Create a new environment by merging these configurations with the env's default ones\n const customReactEnv = react.compose([react.overrideBuildPipe(tasks)]);\n\n // register the extension as an environment\n envs.registerEnv(customReactEnv);\n return new CustomReact(react);\n }\n}\n")),(0,a.mdx)("h2",null,"Positioning a build task in the pipeline"),(0,a.mdx)("p",null,"A build task is positioned in the build pipeline sequence either by overriding the entire ",(0,a.mdx)("em",{parentName:"p"},"customizable")," pipeline or, by registering it to a location in the pipeline using the designated builder slot."),(0,a.mdx)("h3",null,"Override the build pipeline sequence"),(0,a.mdx)("p",null,"This methodology leaves the task completely agnostic as to its position in the build pipeline. Instead, the task position is determined by the environment using the ",(0,a.mdx)("inlineCode",{parentName:"p"},"getBuildPipe")," Environment Handler."),(0,a.mdx)("p",null,"The example above shows the React environment ",(0,a.mdx)("inlineCode",{parentName:"p"},"overrideBuildPipe")," method being used to override its default pipeline. This method uses the ",(0,a.mdx)("inlineCode",{parentName:"p"},"getBuildPipe()")," Environment Handler, internally."),(0,a.mdx)("h3",null,"Append to the start or end of the pipeline, in relation to other tasks"),(0,a.mdx)("p",null,"This methodology places the task at the start or end of the build pipeline sequence, and lists all other tasks needed to run successfully before it is executed."),(0,a.mdx)("p",null,"Example:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="print-cmp-name-task.ts"',title:'"print-cmp-name-task.ts"'},"import { BuildTask, BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\n\nexport class PrintCmpNameTask implements BuildTask {\n constructor(readonly aspectId: string, readonly name: string) {}\n\n // Place the task at the end of the build pipeline\n readonly location = 'end';\n\n // Run this task only after the '@teambit/preview' task is completed successfully\n readonly dependencies = ['@teambit/preview'];\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const componentsResults: ComponentResult[] = [];\n context.capsuleNetwork.seedersCapsules.forEach((capsule) => {\n console.log(`The current component name is: ${capsule.component.id.name}`);\n\n componentsResults.push({\n component: capsule.component,\n metadata: { customProp: capsule.component.id.name },\n });\n });\n return {\n componentsResults,\n };\n }\n}\n")),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="customized-react.extension.ts"',title:'"customized-react.extension.ts"'},"import { EnvsMain, EnvsAspect } from '@teambit/envs';\nimport { ReactAspect, ReactMain } from '@teambit/react';\nimport { BuilderMain } from '@teambit/builder';\n\n// Import the task (in reality, it should be an independent component)\nimport { PrintCmpNameTask } from './print-cmp-name-task';\n\nexport class CustomReact {\n constructor(private react: ReactMain) {}\n\n static dependencies: any = [EnvsAspect, ReactAspect];\n\n // Inject the builder\n static async provider([envs, react, builder]: [EnvsMain, ReactMain, BuilderMain]) {\n // Register this task using the registration slot, made available by the 'builder'.\n // Here, the environment has no say in the positioning of the task\n builder.registerBuildTasks([new ExampleTask('extensions/custom-react', 'PrintCmpNameTask')]);\n\n const customReactEnv = react.compose([]);\n\n envs.registerEnv(customReactEnv);\n return new CustomReact(react);\n }\n}\n")),(0,a.mdx)("h2",null,"A build task anatomy"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"aspectId")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"aspectId: string"),(0,a.mdx)("br",null),"\nThe component ID of the environment using this task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"name")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"name: string")," ",(0,a.mdx)("br",null),"\nA name for this task. Only alphanumerical characters are allowed. PascalCase should be used as a convention.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"location")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"location?: 'start' | 'end'")," ",(0,a.mdx)("br",null),"\nThe section of the build-pipeline to which to append this task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"dependencies")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"dependencies?: string[]")," ",(0,a.mdx)("br",null),"\nAn list of tasks that must be completed before this task gets executed. ",(0,a.mdx)("br",null),"\nFor example ",(0,a.mdx)("inlineCode",{parentName:"p"},"dependencies = ['@teambit/preview']"),".")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"execute")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"execute(context: BuildContext): Promise<BuiltTaskResult>")," ",(0,a.mdx)("br",null),"\nThe execute method is where all the task logic is placed."),(0,a.mdx)("ul",{parentName:"li"},(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"context")," (argument) ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"context: BuildContext")," ",(0,a.mdx)("br",null),"\nThe context of the build pipeline. Use this object (provided by the build pipeline) to get information regarding all components handled by the build pipeline. ",(0,a.mdx)("br",null),(0,a.mdx)("br",null),"\nFor example, ",(0,a.mdx)("inlineCode",{parentName:"p"},"context.capsuleNetwork.seedersCapsules")," are models representing isolated instances of components handled by the build pipeline. These isolated instances are independent projects, generated in your local filesystem (by the build pipeline).")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"return")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"Promise<BuiltTaskResult>")," ",(0,a.mdx)("br",null),"\nA ",(0,a.mdx)("inlineCode",{parentName:"p"},"context")," method returns an object with data regarding the build task process, additional data regarding the components handled by the task and, if available, data regarding the different artifacts generated by this task.",(0,a.mdx)("br",null),"\nThe returned object has the following attributes:"),(0,a.mdx)("ul",{parentName:"li"},(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"componentsResults")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"componentsResults: ComponentResult[]"),"\nAn array of objects, each containing an instance of an object handled the task and additional information regarding the process and the component itself.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"component")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"component: Component")," ",(0,a.mdx)("br",null),"\nAn instance of the component handled by the task (see the above task example).")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"metadata")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"metadata?: { [key: string]: Serializable }")," ",(0,a.mdx)("br",null),"\nComponent metadata generated during the build task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"errors")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"errors?: Array<Error | string>")," ",(0,a.mdx)("br",null),"\nBuild task errors. A task returning errors will abort the build pipeline and log the returned errors.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"warnings")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"warnings?: string[]")," ",(0,a.mdx)("br",null),"\nwarnings generated throughout the build task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"startTime")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"startTime?: number")," ",(0,a.mdx)("br",null),"\nA timestamp (in milliseconds) of when the task started")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"endTime")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"endTime?: number")," ",(0,a.mdx)("br",null),"\nA timestamp (in milliseconds) of when the task ended")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"artifacts")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"artifacts?: ArtifactDefinition[]")," ",(0,a.mdx)("br",null),"\nAn array of artifact definitions to generate after a successful build")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"name")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"name: string")," ",(0,a.mdx)("br",null),"\nThe name of the artifact. ",(0,a.mdx)("br",null),"\nFor example, a project might utilize two different artifacts for the same typescript compiler, one that generates ES5 files and another for ES6. This prop helps to distinguish between the two.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"generatedBy")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"generatedBy?: string;")," ",(0,a.mdx)("br",null),"\nId of the component that generated this artifact.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"description")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"description?: string")," ",(0,a.mdx)("br",null),"\nA description of the artifact. ",(0,a.mdx)("br",null))),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"globPatterns")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"globPatterns: string[]")," ",(0,a.mdx)("br",null),"\nGlob patterns of files to include upon artifact creation. Minimatch is used to match the patterns. ",(0,a.mdx)("br",null),"\nFor example, ",(0,a.mdx)("inlineCode",{parentName:"p"},"['*.ts', '!foo.ts']")," matches all ts files but ignores ",(0,a.mdx)("inlineCode",{parentName:"p"},"foo.ts"),".")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"rootDir")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"rootDir?: string")," ",(0,a.mdx)("br",null),"\nDefines the root directory of the artifacts in the capsule file system. The rootDir must be unique for every artifact, otherwise data might be overridden.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"dirPrefix")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"dirPrefix?: string")," ",(0,a.mdx)("br",null),"\nAdds a directory prefix for all artifact files.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"context")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"context?: 'component' | 'env'")," ",(0,a.mdx)("br",null),"\nDetermine the context of the artifact. The default artifact context is ",(0,a.mdx)("inlineCode",{parentName:"p"},"component"),". ",(0,a.mdx)("inlineCode",{parentName:"p"},"env"),' is useful when the same file is generated for all components, for example, a "preview" task may create the same webpack file for all components of that env.')),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"storageResolver")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"storageResolver?: string")," ",(0,a.mdx)("br",null),"\nUsed to replace the location of the stored artifacts. The default resolver persists artifacts on scope (that's not recommended for large files).")))))),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"preBuild")," (advanced) ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"preBuild?(context: BuildContext): Promise<void>")," ",(0,a.mdx)("br",null),"\nRuns before the build pipeline has started. This method should only be used when preparations are needed to be done on all environments before the build starts.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"postBuild")," (advanced) ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>")," ",(0,a.mdx)("br",null),"\nRuns after the dependencies were completed for all environments."))))}u.__bit_component=i,u.isMDXComponent=!0},16033:(e,n,t)=>{Object.defineProperty(n,"M",{enumerable:!0,get:function(){return i.default}});var i=a(t(51935));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.pipelines/aspect-docs/builder@0.0.168",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0}},2496:(e,n,t)=>{var i={id:"teambit.pipelines/builder@1.0.269",homepage:"https://bit.cloud/teambit/pipelines/builder",exported:!0};function a(){const e=r(t(41594));return a=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,a.__bit_component=i,r.__bit_component=i;const o=()=>a().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},a().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/builder.svg"}));o.__bit_component=i,n.Logo=o},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},n={};function t(i){var a=n[i];if(void 0!==a)return a.exports;var r=n[i]={exports:{}};return e[i](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{t.r(i),t.d(i,{compositions:()=>u,compositions_metadata:()=>h,overview:()=>c});var e={};t.r(e),t.d(e,{default:()=>m});var n=t(2496),a=(t(41594),t(5016));const r=TeambitMdxUiMdxScopeContext;var o=t(16033),s=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l.apply(this,arguments)}var d={},p="wrapper";function m(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,i,a=function(e,n){if(null==e)return{};var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;t[i]=e[i]}return t}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}(e,s);return(0,a.mdx)(p,l({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.mdx)(r.MDXScopeProvider,{components:{Builder:o.M},mdxType:"MDXScopeProvider"},(0,a.mdx)(o.M,{mdxType:"Builder"})))}m.isMDXComponent=!0;const u=[n],c=[e],h={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),i})()));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.pipelines/builder-preview"]=n():e["teambit.pipelines/builder-preview"]=n()}(self,(()=>(()=>{"use strict";var e={51935:(e,n,t)=>{var i={id:"teambit.pipelines/aspect-docs/builder@0.0.168",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,o(t(41594));var a=t(5016),r=["components"];function o(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},s.apply(this,arguments)}function l(e,n){if(null==e)return{};var t,i,a=d(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function d(e,n){if(null==e)return{};var t,i,a={},r=Object.keys(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||(a[t]=e[t]);return a}o.__bit_component=i,s.__bit_component=i,l.__bit_component=i,d.__bit_component=i;var p={},m="wrapper";function u(e){var n=e.components,t=l(e,r);return(0,a.mdx)(m,s({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.mdx)("h2",null,"Background"),(0,a.mdx)("p",null,"Bit's build process is an extensible CI for independent components. It validates a component is not dependent on its context (the workspace), tests it, and generates all artifacts necessary for it to be viewed and consumed as an independent module (its distributable code, bundled preview, etc.)."),(0,a.mdx)("p",null,"The Build Pipeline is an Environment Service responsible for sequencing and executing a component's Build Tasks. As mentioned earlier, these tasks are performed on a component only after it's been isolated from the rest of the workspace."),(0,a.mdx)("p",null,"A component's default series of Build Tasks is composed of tasks set by Bit and by its environment."),(0,a.mdx)("h2",null,"Isolated builds"),(0,a.mdx)("p",null,"Components authored in a Bit workspace are created to be completely portable, and thus independent. To address that, the build process starts by creating a component 'capsule' which is an isolated instance of a component, generated in a separate directory in your filesystem."),(0,a.mdx)("p",null,'As part of the capsule creation, all packages listed as dependencies of that component will be installed. This step is necessary to validate there are no dependency-graph issues (a component that is not totally isolated will be able to use packages installed in parent directories in your workspace, by other components. This will translate into a "false positive" result when testing for dependency-graph issues in a non-isolated location).'),(0,a.mdx)("h2",null,"Incremental builds"),(0,a.mdx)("p",null,'When a component "goes through" the build pipeline, all of its dependencies are built as well. If a dependency has not changed since its last build, the build process will use its artifacts from the previous build (and will not process it again). This optimization to the build process supplements the "innate optimization" that naturally comes from developing (and building) independent components instead of a single monolithic codebase.'),(0,a.mdx)("h2",null,"Environment-specific builds"),(0,a.mdx)("p",null,"Each Bit environment determines its own build pipeline. That means, a single workspace that uses multiple environments will run a different set of build tasks on different components depending on their associated environment. This is another Bit feature that enables seamless transitioning between different development environments, all in the same workspace. It also makes it much easier to integrate the Build Pipeline in your (remote) CI, as it only requires executing the build step - all other per-component build configurations are already set by the various environments being used."),(0,a.mdx)("p",null,"Since environments are extensible, so are the build pipelines configured by them."),(0,a.mdx)("h2",null,"Build task"),(0,a.mdx)("p",null,"An example of a build-task is ",(0,a.mdx)("inlineCode",{parentName:"p"},"compile"),", it's written in the compiler aspect and is running on each one of the capsules created by the build process. build-tasks in many cases generate artifacts, in this case, the compiler generates ",(0,a.mdx)("inlineCode",{parentName:"p"},"dists")," files and write them on the isolated capsules. There artifacts files are used later for example when creating packages."),(0,a.mdx)("h2",null,"Pipelines"),(0,a.mdx)("p",null,"There are three pipelines: ",(0,a.mdx)("inlineCode",{parentName:"p"},"build"),", ",(0,a.mdx)("inlineCode",{parentName:"p"},"tag")," and ",(0,a.mdx)("inlineCode",{parentName:"p"},"snap"),"."),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit build")," runs the build pipeline."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit tag")," runs the build pipeline and then the tag pipeline."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit snap")," runs the build pipeline and then the snap pipeline.")),(0,a.mdx)("h2",null,"List Build Tasks"),(0,a.mdx)("p",null,"To get a list of all the tasks that will be running per pipeline on a specific component, run ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit build --list-tasks <id>"),".\nHere is an example of the relevant part from the output:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"➜ bit build --list-tasks ui/tooltip\nTasks List\nid: teambit.design/ui/tooltip@0.0.347\nenvId: teambit.react/react\n\nBuild Pipeline Tasks:\nteambit.harmony/aspect:CoreExporter\nteambit.compilation/compiler:TSCompiler\nteambit.defender/tester:TestComponents\nteambit.pkg/pkg:PreparePackages\nteambit.pkg/pkg:PublishDryRun\nteambit.preview/preview:GeneratePreview\n\nTag Pipeline Tasks:\nteambit.harmony/application:build_ui_application\nteambit.pkg/pkg:PublishComponents\n\nSnap Pipeline Tasks:\n<N/A>\n")),(0,a.mdx)("h2",null,"Implementing Build Tasks"),(0,a.mdx)("p",null,"The ",(0,a.mdx)("inlineCode",{parentName:"p"},"BuildTask")," interface is a good start to understand how to implement a new build-task.\nWhen writing a build task, the ",(0,a.mdx)("inlineCode",{parentName:"p"},"Network")," object is passed and it includes the seeders capsules, as well as the entire graph including the dependencies.\nKeep in mind that the entire graph may contain components from other envs."),(0,a.mdx)("p",null,"Some tasks, such as, compiling in typescript and bundling with Webpack, need the entire graph.\nOthers, such as, Babel, need only the seeders. However, normally, the bundling is running after the compilation and it expects to have the dependencies compiled, so you might need the entire graph regardless."),(0,a.mdx)("h2",null,"Adding Tasks to a pipeline"),(0,a.mdx)("p",null,"There are two ways of adding tasks to the build pipeline."),(0,a.mdx)("ol",null,(0,a.mdx)("li",{parentName:"ol"},(0,a.mdx)("inlineCode",{parentName:"li"},"getBuildPipe()")," method of the env. (or ",(0,a.mdx)("inlineCode",{parentName:"li"},"getTagPipe()")," and ",(0,a.mdx)("inlineCode",{parentName:"li"},"getSnapPipe()"),")"),(0,a.mdx)("li",{parentName:"ol"},"registering to the slot via ",(0,a.mdx)("inlineCode",{parentName:"li"},"builder.registerBuildTask()"),". (or ",(0,a.mdx)("inlineCode",{parentName:"li"},"registerTagTask()")," and ",(0,a.mdx)("inlineCode",{parentName:"li"},"registerSnapTask()"),")")),(0,a.mdx)("p",null,"in the option #1, it's possible to determine the order. e.g. ",(0,a.mdx)("inlineCode",{parentName:"p"},"getBuildPipe() { return [taskA, taskB, taskC]; }"),"\nin the option #2, the register happens once the extension is loaded, so there is no way to put\none task before/after another task as of now."),(0,a.mdx)("h2",null,"Sequencing the build tasks"),(0,a.mdx)("p",null,"The Build Pipeline takes into consideration the following factors when deciding the order of which to execute each task:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("strong",{parentName:"li"},"Location"),": A task can be executed either at the start or end of the build pipeline. This can be explicitly configured by the task itself."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("strong",{parentName:"li"},"Dependencies"),": A task can depend on other tasks. That means, the dependencies must be completed successfully for all envs before this task starts. The dependencies are applicable inside a location and not across locations. This is configured by the task itself."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("strong",{parentName:"li"},"An environment's list of build tasks"),": This is the array of tasks as it is defined by an environment")),(0,a.mdx)("h2",null,"Executing the pipelines"),(0,a.mdx)("p",null,"Commands that trigger the build pipeline:"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit build")," - runs the build pipeline on your local machine, for the entire workspace. The output data will not persist. - That is most often used for testing and debugging the build process."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit tag")," - runs the tag pipeline in addition to the build pipeline, before creating a new component release version. The output data will persist."),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("inlineCode",{parentName:"li"},"bit snap")," - runs the snap pipeline in addition to the build pipeline. The output data will persist.")),(0,a.mdx)("p",null,"Build pipelines are determined by the environments in use. That means, in order to override the default pipeline, we need to create a new environment extension or modify an existing one."),(0,a.mdx)("p",null,"The example task below, shown being used by a customized environment, prints out the component name of every component handled by it. In addition to that, the task returns the component name as custom metadata to be logged and/or stored in the component tagged version. ",(0,a.mdx)("a",{parentName:"p",href:"https://github.com/teambit/harmony-build-examples"},"See a demo project here"),"."),(0,a.mdx)("blockquote",null,(0,a.mdx)("p",{parentName:"blockquote"},"Information returned by a build task will only persist if the build-pipeline was triggered by the 'hard-tag' command (",(0,a.mdx)("inlineCode",{parentName:"p"},"bit tag <component-id>"),").")),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="print-cmp-name-task.ts"',title:'"print-cmp-name-task.ts"'},"import { BuildTask, BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\n\n// A task is an implementation of 'BuildTask' provided by the 'builder' aspect\nexport class PrintCmpNameTask implements BuildTask {\n // The constructor leaves these properties up to the hands of the environment using this task\n constructor(readonly aspectId: string, readonly name: string) {}\n\n // This is where the task logic is placed. It will be executed by the build pipeline\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const componentsResults: ComponentResult[] = [];\n\n // Go through every isolated component instance\n context.capsuleNetwork.seedersCapsules.forEach((capsule) => {\n console.log(`The current component name is: ${capsule.component.id.name}`);\n\n componentsResults.push({\n component: capsule.component,\n metadata: { customProp: capsule.component.id.name },\n });\n });\n return {\n // An array of component objects, enriched with additional data produced by the task\n componentsResults,\n };\n }\n}\n")),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="customized-react.extension.ts"',title:'"customized-react.extension.ts"'},"import { EnvsMain, EnvsAspect } from '@teambit/envs';\nimport { ReactAspect, ReactMain } from '@teambit/react';\n\n// Import the task\nimport { PrintCmpNameTask } from './print-cmp-name-task';\n\nexport class CustomReact {\n constructor(private react: ReactMain) {}\n\n static dependencies: any = [EnvsAspect, ReactAspect];\n\n static async provider([envs, react]: [EnvsMain, ReactMain]) {\n // Get the environment's default build pipeline\n const reactPipe = react.env.getBuildPipe();\n\n // Add the custom task to the end of the build tasks sequence.\n // Provide the task with the component ID of the extension using it.\n // Provide the ask with a name.\n const tasks = [...reactPipe, new PrintCompTask('extensions/custom-react', 'PrintCmpNameTask')];\n\n // Create a new environment by merging these configurations with the env's default ones\n const customReactEnv = react.compose([react.overrideBuildPipe(tasks)]);\n\n // register the extension as an environment\n envs.registerEnv(customReactEnv);\n return new CustomReact(react);\n }\n}\n")),(0,a.mdx)("h2",null,"Positioning a build task in the pipeline"),(0,a.mdx)("p",null,"A build task is positioned in the build pipeline sequence either by overriding the entire ",(0,a.mdx)("em",{parentName:"p"},"customizable")," pipeline or, by registering it to a location in the pipeline using the designated builder slot."),(0,a.mdx)("h3",null,"Override the build pipeline sequence"),(0,a.mdx)("p",null,"This methodology leaves the task completely agnostic as to its position in the build pipeline. Instead, the task position is determined by the environment using the ",(0,a.mdx)("inlineCode",{parentName:"p"},"getBuildPipe")," Environment Handler."),(0,a.mdx)("p",null,"The example above shows the React environment ",(0,a.mdx)("inlineCode",{parentName:"p"},"overrideBuildPipe")," method being used to override its default pipeline. This method uses the ",(0,a.mdx)("inlineCode",{parentName:"p"},"getBuildPipe()")," Environment Handler, internally."),(0,a.mdx)("h3",null,"Append to the start or end of the pipeline, in relation to other tasks"),(0,a.mdx)("p",null,"This methodology places the task at the start or end of the build pipeline sequence, and lists all other tasks needed to run successfully before it is executed."),(0,a.mdx)("p",null,"Example:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="print-cmp-name-task.ts"',title:'"print-cmp-name-task.ts"'},"import { BuildTask, BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\n\nexport class PrintCmpNameTask implements BuildTask {\n constructor(readonly aspectId: string, readonly name: string) {}\n\n // Place the task at the end of the build pipeline\n readonly location = 'end';\n\n // Run this task only after the '@teambit/preview' task is completed successfully\n readonly dependencies = ['@teambit/preview'];\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const componentsResults: ComponentResult[] = [];\n context.capsuleNetwork.seedersCapsules.forEach((capsule) => {\n console.log(`The current component name is: ${capsule.component.id.name}`);\n\n componentsResults.push({\n component: capsule.component,\n metadata: { customProp: capsule.component.id.name },\n });\n });\n return {\n componentsResults,\n };\n }\n}\n")),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-ts",metastring:'title="customized-react.extension.ts"',title:'"customized-react.extension.ts"'},"import { EnvsMain, EnvsAspect } from '@teambit/envs';\nimport { ReactAspect, ReactMain } from '@teambit/react';\nimport { BuilderMain } from '@teambit/builder';\n\n// Import the task (in reality, it should be an independent component)\nimport { PrintCmpNameTask } from './print-cmp-name-task';\n\nexport class CustomReact {\n constructor(private react: ReactMain) {}\n\n static dependencies: any = [EnvsAspect, ReactAspect];\n\n // Inject the builder\n static async provider([envs, react, builder]: [EnvsMain, ReactMain, BuilderMain]) {\n // Register this task using the registration slot, made available by the 'builder'.\n // Here, the environment has no say in the positioning of the task\n builder.registerBuildTasks([new ExampleTask('extensions/custom-react', 'PrintCmpNameTask')]);\n\n const customReactEnv = react.compose([]);\n\n envs.registerEnv(customReactEnv);\n return new CustomReact(react);\n }\n}\n")),(0,a.mdx)("h2",null,"A build task anatomy"),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"aspectId")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"aspectId: string"),(0,a.mdx)("br",null),"\nThe component ID of the environment using this task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"name")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"name: string")," ",(0,a.mdx)("br",null),"\nA name for this task. Only alphanumerical characters are allowed. PascalCase should be used as a convention.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"location")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"location?: 'start' | 'end'")," ",(0,a.mdx)("br",null),"\nThe section of the build-pipeline to which to append this task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"dependencies")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"dependencies?: string[]")," ",(0,a.mdx)("br",null),"\nAn list of tasks that must be completed before this task gets executed. ",(0,a.mdx)("br",null),"\nFor example ",(0,a.mdx)("inlineCode",{parentName:"p"},"dependencies = ['@teambit/preview']"),".")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"execute")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"execute(context: BuildContext): Promise<BuiltTaskResult>")," ",(0,a.mdx)("br",null),"\nThe execute method is where all the task logic is placed."),(0,a.mdx)("ul",{parentName:"li"},(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"context")," (argument) ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"context: BuildContext")," ",(0,a.mdx)("br",null),"\nThe context of the build pipeline. Use this object (provided by the build pipeline) to get information regarding all components handled by the build pipeline. ",(0,a.mdx)("br",null),(0,a.mdx)("br",null),"\nFor example, ",(0,a.mdx)("inlineCode",{parentName:"p"},"context.capsuleNetwork.seedersCapsules")," are models representing isolated instances of components handled by the build pipeline. These isolated instances are independent projects, generated in your local filesystem (by the build pipeline).")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"return")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"Promise<BuiltTaskResult>")," ",(0,a.mdx)("br",null),"\nA ",(0,a.mdx)("inlineCode",{parentName:"p"},"context")," method returns an object with data regarding the build task process, additional data regarding the components handled by the task and, if available, data regarding the different artifacts generated by this task.",(0,a.mdx)("br",null),"\nThe returned object has the following attributes:"),(0,a.mdx)("ul",{parentName:"li"},(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"componentsResults")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"componentsResults: ComponentResult[]"),"\nAn array of objects, each containing an instance of an object handled the task and additional information regarding the process and the component itself.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"component")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"component: Component")," ",(0,a.mdx)("br",null),"\nAn instance of the component handled by the task (see the above task example).")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"metadata")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"metadata?: { [key: string]: Serializable }")," ",(0,a.mdx)("br",null),"\nComponent metadata generated during the build task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"errors")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"errors?: Array<Error | string>")," ",(0,a.mdx)("br",null),"\nBuild task errors. A task returning errors will abort the build pipeline and log the returned errors.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"warnings")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"warnings?: string[]")," ",(0,a.mdx)("br",null),"\nwarnings generated throughout the build task.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"startTime")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"startTime?: number")," ",(0,a.mdx)("br",null),"\nA timestamp (in milliseconds) of when the task started")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"endTime")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"endTime?: number")," ",(0,a.mdx)("br",null),"\nA timestamp (in milliseconds) of when the task ended")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"artifacts")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"artifacts?: ArtifactDefinition[]")," ",(0,a.mdx)("br",null),"\nAn array of artifact definitions to generate after a successful build")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"name")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"name: string")," ",(0,a.mdx)("br",null),"\nThe name of the artifact. ",(0,a.mdx)("br",null),"\nFor example, a project might utilize two different artifacts for the same typescript compiler, one that generates ES5 files and another for ES6. This prop helps to distinguish between the two.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"generatedBy")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"generatedBy?: string;")," ",(0,a.mdx)("br",null),"\nId of the component that generated this artifact.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"description")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"description?: string")," ",(0,a.mdx)("br",null),"\nA description of the artifact. ",(0,a.mdx)("br",null))),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"globPatterns")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"globPatterns: string[]")," ",(0,a.mdx)("br",null),"\nGlob patterns of files to include upon artifact creation. Minimatch is used to match the patterns. ",(0,a.mdx)("br",null),"\nFor example, ",(0,a.mdx)("inlineCode",{parentName:"p"},"['*.ts', '!foo.ts']")," matches all ts files but ignores ",(0,a.mdx)("inlineCode",{parentName:"p"},"foo.ts"),".")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"rootDir")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"rootDir?: string")," ",(0,a.mdx)("br",null),"\nDefines the root directory of the artifacts in the capsule file system. The rootDir must be unique for every artifact, otherwise data might be overridden.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"dirPrefix")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"dirPrefix?: string")," ",(0,a.mdx)("br",null),"\nAdds a directory prefix for all artifact files.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"context")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"context?: 'component' | 'env'")," ",(0,a.mdx)("br",null),"\nDetermine the context of the artifact. The default artifact context is ",(0,a.mdx)("inlineCode",{parentName:"p"},"component"),". ",(0,a.mdx)("inlineCode",{parentName:"p"},"env"),' is useful when the same file is generated for all components, for example, a "preview" task may create the same webpack file for all components of that env.')),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"storageResolver")," ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"storageResolver?: string")," ",(0,a.mdx)("br",null),"\nUsed to replace the location of the stored artifacts. The default resolver persists artifacts on scope (that's not recommended for large files).")))))),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"preBuild")," (advanced) ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"preBuild?(context: BuildContext): Promise<void>")," ",(0,a.mdx)("br",null),"\nRuns before the build pipeline has started. This method should only be used when preparations are needed to be done on all environments before the build starts.")),(0,a.mdx)("li",{parentName:"ul"},(0,a.mdx)("p",{parentName:"li"},(0,a.mdx)("strong",{parentName:"p"},"postBuild")," (advanced) ",(0,a.mdx)("br",null),"\n",(0,a.mdx)("inlineCode",{parentName:"p"},"postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>")," ",(0,a.mdx)("br",null),"\nRuns after the dependencies were completed for all environments."))))}u.__bit_component=i,u.isMDXComponent=!0},16033:(e,n,t)=>{Object.defineProperty(n,"M",{enumerable:!0,get:function(){return i.default}});var i=a(t(51935));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.pipelines/aspect-docs/builder@0.0.168",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0}},14167:(e,n,t)=>{var i={id:"teambit.pipelines/builder@1.0.271",homepage:"https://bit.cloud/teambit/pipelines/builder",exported:!0};function a(){const e=r(t(41594));return a=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,a.__bit_component=i,r.__bit_component=i;const o=()=>a().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},a().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/builder.svg"}));o.__bit_component=i,n.Logo=o},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},n={};function t(i){var a=n[i];if(void 0!==a)return a.exports;var r=n[i]={exports:{}};return e[i](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{t.r(i),t.d(i,{compositions:()=>u,compositions_metadata:()=>h,overview:()=>c});var e={};t.r(e),t.d(e,{default:()=>m});var n=t(14167),a=(t(41594),t(5016));const r=TeambitMdxUiMdxScopeContext;var o=t(16033),s=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l.apply(this,arguments)}var d={},p="wrapper";function m(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,i,a=function(e,n){if(null==e)return{};var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(n.indexOf(i)>=0)continue;t[i]=e[i]}return t}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)t=r[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}(e,s);return(0,a.mdx)(p,l({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.mdx)(r.MDXScopeProvider,{components:{Builder:o.M},mdxType:"MDXScopeProvider"},(0,a.mdx)(o.M,{mdxType:"Builder"})))}m.isMDXComponent=!0;const u=[n],c=[e],h={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),i})()));
@@ -1117,7 +1117,7 @@
1117
1117
  "_legacy": {
1118
1118
  "scope": "teambit.pipelines",
1119
1119
  "name": "builder",
1120
- "version": "1.0.269"
1120
+ "version": "1.0.271"
1121
1121
  },
1122
1122
  "_scope": "teambit.pipelines"
1123
1123
  }
@@ -7629,7 +7629,7 @@
7629
7629
  "_legacy": {
7630
7630
  "scope": "teambit.pipelines",
7631
7631
  "name": "builder",
7632
- "version": "1.0.269"
7632
+ "version": "1.0.271"
7633
7633
  },
7634
7634
  "_scope": "teambit.pipelines"
7635
7635
  }
@@ -7651,7 +7651,7 @@
7651
7651
  "__schema": "ClassSchema",
7652
7652
  "location": {
7653
7653
  "filePath": "artifact/artifact-factory.ts",
7654
- "line": 18,
7654
+ "line": 19,
7655
7655
  "character": 1
7656
7656
  },
7657
7657
  "signature": "class ArtifactFactory",
@@ -7661,7 +7661,7 @@
7661
7661
  "__schema": "FunctionLikeSchema",
7662
7662
  "location": {
7663
7663
  "filePath": "artifact/artifact-factory.ts",
7664
- "line": 19,
7664
+ "line": 20,
7665
7665
  "character": 3
7666
7666
  },
7667
7667
  "signature": "(method) ArtifactFactory.resolvePaths(root: string, def: ArtifactDefinition): string[]",
@@ -7671,7 +7671,7 @@
7671
7671
  "__schema": "ParameterSchema",
7672
7672
  "location": {
7673
7673
  "filePath": "artifact/artifact-factory.ts",
7674
- "line": 19,
7674
+ "line": 20,
7675
7675
  "character": 16
7676
7676
  },
7677
7677
  "name": "root",
@@ -7679,7 +7679,7 @@
7679
7679
  "__schema": "KeywordTypeSchema",
7680
7680
  "location": {
7681
7681
  "filePath": "artifact/artifact-factory.ts",
7682
- "line": 19,
7682
+ "line": 20,
7683
7683
  "character": 22
7684
7684
  },
7685
7685
  "name": "string"
@@ -7691,7 +7691,7 @@
7691
7691
  "__schema": "ParameterSchema",
7692
7692
  "location": {
7693
7693
  "filePath": "artifact/artifact-factory.ts",
7694
- "line": 19,
7694
+ "line": 20,
7695
7695
  "character": 30
7696
7696
  },
7697
7697
  "name": "def",
@@ -7699,7 +7699,7 @@
7699
7699
  "__schema": "TypeRefSchema",
7700
7700
  "location": {
7701
7701
  "filePath": "artifact/artifact-factory.ts",
7702
- "line": 19,
7702
+ "line": 20,
7703
7703
  "character": 35
7704
7704
  },
7705
7705
  "name": "ArtifactDefinition"
@@ -7712,14 +7712,14 @@
7712
7712
  "__schema": "TypeArraySchema",
7713
7713
  "location": {
7714
7714
  "filePath": "artifact/artifact-factory.ts",
7715
- "line": 19,
7715
+ "line": 20,
7716
7716
  "character": 56
7717
7717
  },
7718
7718
  "type": {
7719
7719
  "__schema": "KeywordTypeSchema",
7720
7720
  "location": {
7721
7721
  "filePath": "artifact/artifact-factory.ts",
7722
- "line": 19,
7722
+ "line": 20,
7723
7723
  "character": 56
7724
7724
  },
7725
7725
  "name": "string"
@@ -7731,7 +7731,7 @@
7731
7731
  "__schema": "FunctionLikeSchema",
7732
7732
  "location": {
7733
7733
  "filePath": "artifact/artifact-factory.ts",
7734
- "line": 41,
7734
+ "line": 42,
7735
7735
  "character": 3
7736
7736
  },
7737
7737
  "signature": "(method) ArtifactFactory.createFromComponent(context: BuildContext, component: Component, def: ArtifactDefinition, task: BuildTask): FsArtifact | undefined",
@@ -7741,7 +7741,7 @@
7741
7741
  "__schema": "ParameterSchema",
7742
7742
  "location": {
7743
7743
  "filePath": "artifact/artifact-factory.ts",
7744
- "line": 42,
7744
+ "line": 43,
7745
7745
  "character": 5
7746
7746
  },
7747
7747
  "name": "context",
@@ -7749,7 +7749,7 @@
7749
7749
  "__schema": "TypeRefSchema",
7750
7750
  "location": {
7751
7751
  "filePath": "artifact/artifact-factory.ts",
7752
- "line": 42,
7752
+ "line": 43,
7753
7753
  "character": 14
7754
7754
  },
7755
7755
  "name": "BuildContext"
@@ -7761,7 +7761,7 @@
7761
7761
  "__schema": "ParameterSchema",
7762
7762
  "location": {
7763
7763
  "filePath": "artifact/artifact-factory.ts",
7764
- "line": 43,
7764
+ "line": 44,
7765
7765
  "character": 5
7766
7766
  },
7767
7767
  "name": "component",
@@ -7769,7 +7769,7 @@
7769
7769
  "__schema": "TypeRefSchema",
7770
7770
  "location": {
7771
7771
  "filePath": "artifact/artifact-factory.ts",
7772
- "line": 43,
7772
+ "line": 44,
7773
7773
  "character": 16
7774
7774
  },
7775
7775
  "name": "Component",
@@ -7785,7 +7785,7 @@
7785
7785
  "__schema": "ParameterSchema",
7786
7786
  "location": {
7787
7787
  "filePath": "artifact/artifact-factory.ts",
7788
- "line": 44,
7788
+ "line": 45,
7789
7789
  "character": 5
7790
7790
  },
7791
7791
  "name": "def",
@@ -7793,7 +7793,7 @@
7793
7793
  "__schema": "TypeRefSchema",
7794
7794
  "location": {
7795
7795
  "filePath": "artifact/artifact-factory.ts",
7796
- "line": 44,
7796
+ "line": 45,
7797
7797
  "character": 10
7798
7798
  },
7799
7799
  "name": "ArtifactDefinition"
@@ -7805,7 +7805,7 @@
7805
7805
  "__schema": "ParameterSchema",
7806
7806
  "location": {
7807
7807
  "filePath": "artifact/artifact-factory.ts",
7808
- "line": 45,
7808
+ "line": 46,
7809
7809
  "character": 5
7810
7810
  },
7811
7811
  "name": "task",
@@ -7813,7 +7813,7 @@
7813
7813
  "__schema": "TypeRefSchema",
7814
7814
  "location": {
7815
7815
  "filePath": "artifact/artifact-factory.ts",
7816
- "line": 45,
7816
+ "line": 46,
7817
7817
  "character": 11
7818
7818
  },
7819
7819
  "name": "BuildTask"
@@ -7826,7 +7826,7 @@
7826
7826
  "__schema": "TypeUnionSchema",
7827
7827
  "location": {
7828
7828
  "filePath": "artifact/artifact-factory.ts",
7829
- "line": 46,
7829
+ "line": 47,
7830
7830
  "character": 6
7831
7831
  },
7832
7832
  "types": [
@@ -7834,7 +7834,7 @@
7834
7834
  "__schema": "TypeRefSchema",
7835
7835
  "location": {
7836
7836
  "filePath": "artifact/artifact-factory.ts",
7837
- "line": 46,
7837
+ "line": 47,
7838
7838
  "character": 6
7839
7839
  },
7840
7840
  "name": "FsArtifact",
@@ -7844,7 +7844,7 @@
7844
7844
  "__schema": "KeywordTypeSchema",
7845
7845
  "location": {
7846
7846
  "filePath": "artifact/artifact-factory.ts",
7847
- "line": 46,
7847
+ "line": 47,
7848
7848
  "character": 19
7849
7849
  },
7850
7850
  "name": "undefined"
@@ -7857,7 +7857,7 @@
7857
7857
  "__schema": "FunctionLikeSchema",
7858
7858
  "location": {
7859
7859
  "filePath": "artifact/artifact-factory.ts",
7860
- "line": 69,
7860
+ "line": 70,
7861
7861
  "character": 3
7862
7862
  },
7863
7863
  "signature": "(method) ArtifactFactory.getRootDir(rootDir: string, def: ArtifactDefinition): string",
@@ -7867,7 +7867,7 @@
7867
7867
  "__schema": "ParameterSchema",
7868
7868
  "location": {
7869
7869
  "filePath": "artifact/artifact-factory.ts",
7870
- "line": 69,
7870
+ "line": 70,
7871
7871
  "character": 14
7872
7872
  },
7873
7873
  "name": "rootDir",
@@ -7875,7 +7875,7 @@
7875
7875
  "__schema": "KeywordTypeSchema",
7876
7876
  "location": {
7877
7877
  "filePath": "artifact/artifact-factory.ts",
7878
- "line": 69,
7878
+ "line": 70,
7879
7879
  "character": 23
7880
7880
  },
7881
7881
  "name": "string"
@@ -7887,7 +7887,7 @@
7887
7887
  "__schema": "ParameterSchema",
7888
7888
  "location": {
7889
7889
  "filePath": "artifact/artifact-factory.ts",
7890
- "line": 69,
7890
+ "line": 70,
7891
7891
  "character": 31
7892
7892
  },
7893
7893
  "name": "def",
@@ -7895,7 +7895,7 @@
7895
7895
  "__schema": "TypeRefSchema",
7896
7896
  "location": {
7897
7897
  "filePath": "artifact/artifact-factory.ts",
7898
- "line": 69,
7898
+ "line": 70,
7899
7899
  "character": 36
7900
7900
  },
7901
7901
  "name": "ArtifactDefinition"
@@ -7908,7 +7908,7 @@
7908
7908
  "__schema": "InferenceTypeSchema",
7909
7909
  "location": {
7910
7910
  "filePath": "artifact/artifact-factory.ts",
7911
- "line": 69,
7911
+ "line": 70,
7912
7912
  "character": 3
7913
7913
  },
7914
7914
  "type": "string"
@@ -7919,14 +7919,14 @@
7919
7919
  "__schema": "FunctionLikeSchema",
7920
7920
  "location": {
7921
7921
  "filePath": "artifact/artifact-factory.ts",
7922
- "line": 77,
7922
+ "line": 78,
7923
7923
  "character": 3
7924
7924
  },
7925
7925
  "doc": {
7926
7926
  "__schema": "DocSchema",
7927
7927
  "location": {
7928
7928
  "filePath": "artifact/artifact-factory.ts",
7929
- "line": 74,
7929
+ "line": 75,
7930
7930
  "character": 3
7931
7931
  },
7932
7932
  "raw": "/**\n * generate artifacts from a build context according to the spec defined in the artifact definitions.\n */",
@@ -7939,7 +7939,7 @@
7939
7939
  "__schema": "ParameterSchema",
7940
7940
  "location": {
7941
7941
  "filePath": "artifact/artifact-factory.ts",
7942
- "line": 77,
7942
+ "line": 78,
7943
7943
  "character": 12
7944
7944
  },
7945
7945
  "name": "context",
@@ -7947,7 +7947,7 @@
7947
7947
  "__schema": "TypeRefSchema",
7948
7948
  "location": {
7949
7949
  "filePath": "artifact/artifact-factory.ts",
7950
- "line": 77,
7950
+ "line": 78,
7951
7951
  "character": 21
7952
7952
  },
7953
7953
  "name": "BuildContext"
@@ -7959,7 +7959,7 @@
7959
7959
  "__schema": "ParameterSchema",
7960
7960
  "location": {
7961
7961
  "filePath": "artifact/artifact-factory.ts",
7962
- "line": 77,
7962
+ "line": 78,
7963
7963
  "character": 35
7964
7964
  },
7965
7965
  "name": "defs",
@@ -7967,14 +7967,14 @@
7967
7967
  "__schema": "TypeArraySchema",
7968
7968
  "location": {
7969
7969
  "filePath": "artifact/artifact-factory.ts",
7970
- "line": 77,
7970
+ "line": 78,
7971
7971
  "character": 41
7972
7972
  },
7973
7973
  "type": {
7974
7974
  "__schema": "TypeRefSchema",
7975
7975
  "location": {
7976
7976
  "filePath": "artifact/artifact-factory.ts",
7977
- "line": 77,
7977
+ "line": 78,
7978
7978
  "character": 41
7979
7979
  },
7980
7980
  "name": "ArtifactDefinition"
@@ -7987,7 +7987,7 @@
7987
7987
  "__schema": "ParameterSchema",
7988
7988
  "location": {
7989
7989
  "filePath": "artifact/artifact-factory.ts",
7990
- "line": 77,
7990
+ "line": 78,
7991
7991
  "character": 63
7992
7992
  },
7993
7993
  "name": "task",
@@ -7995,7 +7995,7 @@
7995
7995
  "__schema": "TypeRefSchema",
7996
7996
  "location": {
7997
7997
  "filePath": "artifact/artifact-factory.ts",
7998
- "line": 77,
7998
+ "line": 78,
7999
7999
  "character": 69
8000
8000
  },
8001
8001
  "name": "BuildTask"
@@ -8008,7 +8008,7 @@
8008
8008
  "__schema": "TypeRefSchema",
8009
8009
  "location": {
8010
8010
  "filePath": "artifact/artifact-factory.ts",
8011
- "line": 77,
8011
+ "line": 78,
8012
8012
  "character": 81
8013
8013
  },
8014
8014
  "name": "ComponentMap",
@@ -8021,7 +8021,7 @@
8021
8021
  "__schema": "TypeRefSchema",
8022
8022
  "location": {
8023
8023
  "filePath": "artifact/artifact-factory.ts",
8024
- "line": 77,
8024
+ "line": 78,
8025
8025
  "character": 94
8026
8026
  },
8027
8027
  "name": "ArtifactList",
@@ -8030,7 +8030,7 @@
8030
8030
  "__schema": "TypeRefSchema",
8031
8031
  "location": {
8032
8032
  "filePath": "artifact/artifact-factory.ts",
8033
- "line": 77,
8033
+ "line": 78,
8034
8034
  "character": 107
8035
8035
  },
8036
8036
  "name": "FsArtifact",
@@ -9923,7 +9923,7 @@
9923
9923
  "_legacy": {
9924
9924
  "scope": "teambit.pipelines",
9925
9925
  "name": "builder",
9926
- "version": "1.0.269"
9926
+ "version": "1.0.271"
9927
9927
  },
9928
9928
  "_scope": "teambit.pipelines"
9929
9929
  }
@@ -15404,7 +15404,7 @@
15404
15404
  "__schema": "VariableLikeSchema",
15405
15405
  "location": {
15406
15406
  "filePath": "artifact/artifact-factory.ts",
15407
- "line": 14,
15407
+ "line": 15,
15408
15408
  "character": 14
15409
15409
  },
15410
15410
  "signature": "const DEFAULT_CONTEXT: \"component\"",
@@ -15413,7 +15413,7 @@
15413
15413
  "__schema": "InferenceTypeSchema",
15414
15414
  "location": {
15415
15415
  "filePath": "artifact/artifact-factory.ts",
15416
- "line": 14,
15416
+ "line": 15,
15417
15417
  "character": 14
15418
15418
  },
15419
15419
  "type": "\"component\""
@@ -15425,7 +15425,7 @@
15425
15425
  "__schema": "TypeSchema",
15426
15426
  "location": {
15427
15427
  "filePath": "artifact/artifact-factory.ts",
15428
- "line": 16,
15428
+ "line": 17,
15429
15429
  "character": 1
15430
15430
  },
15431
15431
  "signature": "type ArtifactMap = ComponentMap<ArtifactList<FsArtifact>>",
@@ -15434,7 +15434,7 @@
15434
15434
  "__schema": "TypeRefSchema",
15435
15435
  "location": {
15436
15436
  "filePath": "artifact/artifact-factory.ts",
15437
- "line": 16,
15437
+ "line": 17,
15438
15438
  "character": 27
15439
15439
  },
15440
15440
  "name": "ComponentMap",
@@ -15447,7 +15447,7 @@
15447
15447
  "__schema": "TypeRefSchema",
15448
15448
  "location": {
15449
15449
  "filePath": "artifact/artifact-factory.ts",
15450
- "line": 16,
15450
+ "line": 17,
15451
15451
  "character": 40
15452
15452
  },
15453
15453
  "name": "ArtifactList",
@@ -15456,7 +15456,7 @@
15456
15456
  "__schema": "TypeRefSchema",
15457
15457
  "location": {
15458
15458
  "filePath": "artifact/artifact-factory.ts",
15459
- "line": 16,
15459
+ "line": 17,
15460
15460
  "character": 53
15461
15461
  },
15462
15462
  "name": "FsArtifact",
@@ -15471,7 +15471,7 @@
15471
15471
  "__schema": "ClassSchema",
15472
15472
  "location": {
15473
15473
  "filePath": "artifact/artifact-factory.ts",
15474
- "line": 18,
15474
+ "line": 19,
15475
15475
  "character": 1
15476
15476
  },
15477
15477
  "signature": "class ArtifactFactory",
@@ -15481,7 +15481,7 @@
15481
15481
  "__schema": "FunctionLikeSchema",
15482
15482
  "location": {
15483
15483
  "filePath": "artifact/artifact-factory.ts",
15484
- "line": 19,
15484
+ "line": 20,
15485
15485
  "character": 3
15486
15486
  },
15487
15487
  "signature": "(method) ArtifactFactory.resolvePaths(root: string, def: ArtifactDefinition): string[]",
@@ -15491,7 +15491,7 @@
15491
15491
  "__schema": "ParameterSchema",
15492
15492
  "location": {
15493
15493
  "filePath": "artifact/artifact-factory.ts",
15494
- "line": 19,
15494
+ "line": 20,
15495
15495
  "character": 16
15496
15496
  },
15497
15497
  "name": "root",
@@ -15499,7 +15499,7 @@
15499
15499
  "__schema": "KeywordTypeSchema",
15500
15500
  "location": {
15501
15501
  "filePath": "artifact/artifact-factory.ts",
15502
- "line": 19,
15502
+ "line": 20,
15503
15503
  "character": 22
15504
15504
  },
15505
15505
  "name": "string"
@@ -15511,7 +15511,7 @@
15511
15511
  "__schema": "ParameterSchema",
15512
15512
  "location": {
15513
15513
  "filePath": "artifact/artifact-factory.ts",
15514
- "line": 19,
15514
+ "line": 20,
15515
15515
  "character": 30
15516
15516
  },
15517
15517
  "name": "def",
@@ -15519,7 +15519,7 @@
15519
15519
  "__schema": "TypeRefSchema",
15520
15520
  "location": {
15521
15521
  "filePath": "artifact/artifact-factory.ts",
15522
- "line": 19,
15522
+ "line": 20,
15523
15523
  "character": 35
15524
15524
  },
15525
15525
  "name": "ArtifactDefinition"
@@ -15532,14 +15532,14 @@
15532
15532
  "__schema": "TypeArraySchema",
15533
15533
  "location": {
15534
15534
  "filePath": "artifact/artifact-factory.ts",
15535
- "line": 19,
15535
+ "line": 20,
15536
15536
  "character": 56
15537
15537
  },
15538
15538
  "type": {
15539
15539
  "__schema": "KeywordTypeSchema",
15540
15540
  "location": {
15541
15541
  "filePath": "artifact/artifact-factory.ts",
15542
- "line": 19,
15542
+ "line": 20,
15543
15543
  "character": 56
15544
15544
  },
15545
15545
  "name": "string"
@@ -15551,7 +15551,7 @@
15551
15551
  "__schema": "FunctionLikeSchema",
15552
15552
  "location": {
15553
15553
  "filePath": "artifact/artifact-factory.ts",
15554
- "line": 41,
15554
+ "line": 42,
15555
15555
  "character": 3
15556
15556
  },
15557
15557
  "signature": "(method) ArtifactFactory.createFromComponent(context: BuildContext, component: Component, def: ArtifactDefinition, task: BuildTask): FsArtifact | undefined",
@@ -15561,7 +15561,7 @@
15561
15561
  "__schema": "ParameterSchema",
15562
15562
  "location": {
15563
15563
  "filePath": "artifact/artifact-factory.ts",
15564
- "line": 42,
15564
+ "line": 43,
15565
15565
  "character": 5
15566
15566
  },
15567
15567
  "name": "context",
@@ -15569,7 +15569,7 @@
15569
15569
  "__schema": "TypeRefSchema",
15570
15570
  "location": {
15571
15571
  "filePath": "artifact/artifact-factory.ts",
15572
- "line": 42,
15572
+ "line": 43,
15573
15573
  "character": 14
15574
15574
  },
15575
15575
  "name": "BuildContext"
@@ -15581,7 +15581,7 @@
15581
15581
  "__schema": "ParameterSchema",
15582
15582
  "location": {
15583
15583
  "filePath": "artifact/artifact-factory.ts",
15584
- "line": 43,
15584
+ "line": 44,
15585
15585
  "character": 5
15586
15586
  },
15587
15587
  "name": "component",
@@ -15589,7 +15589,7 @@
15589
15589
  "__schema": "TypeRefSchema",
15590
15590
  "location": {
15591
15591
  "filePath": "artifact/artifact-factory.ts",
15592
- "line": 43,
15592
+ "line": 44,
15593
15593
  "character": 16
15594
15594
  },
15595
15595
  "name": "Component",
@@ -15605,7 +15605,7 @@
15605
15605
  "__schema": "ParameterSchema",
15606
15606
  "location": {
15607
15607
  "filePath": "artifact/artifact-factory.ts",
15608
- "line": 44,
15608
+ "line": 45,
15609
15609
  "character": 5
15610
15610
  },
15611
15611
  "name": "def",
@@ -15613,7 +15613,7 @@
15613
15613
  "__schema": "TypeRefSchema",
15614
15614
  "location": {
15615
15615
  "filePath": "artifact/artifact-factory.ts",
15616
- "line": 44,
15616
+ "line": 45,
15617
15617
  "character": 10
15618
15618
  },
15619
15619
  "name": "ArtifactDefinition"
@@ -15625,7 +15625,7 @@
15625
15625
  "__schema": "ParameterSchema",
15626
15626
  "location": {
15627
15627
  "filePath": "artifact/artifact-factory.ts",
15628
- "line": 45,
15628
+ "line": 46,
15629
15629
  "character": 5
15630
15630
  },
15631
15631
  "name": "task",
@@ -15633,7 +15633,7 @@
15633
15633
  "__schema": "TypeRefSchema",
15634
15634
  "location": {
15635
15635
  "filePath": "artifact/artifact-factory.ts",
15636
- "line": 45,
15636
+ "line": 46,
15637
15637
  "character": 11
15638
15638
  },
15639
15639
  "name": "BuildTask"
@@ -15646,7 +15646,7 @@
15646
15646
  "__schema": "TypeUnionSchema",
15647
15647
  "location": {
15648
15648
  "filePath": "artifact/artifact-factory.ts",
15649
- "line": 46,
15649
+ "line": 47,
15650
15650
  "character": 6
15651
15651
  },
15652
15652
  "types": [
@@ -15654,7 +15654,7 @@
15654
15654
  "__schema": "TypeRefSchema",
15655
15655
  "location": {
15656
15656
  "filePath": "artifact/artifact-factory.ts",
15657
- "line": 46,
15657
+ "line": 47,
15658
15658
  "character": 6
15659
15659
  },
15660
15660
  "name": "FsArtifact",
@@ -15664,7 +15664,7 @@
15664
15664
  "__schema": "KeywordTypeSchema",
15665
15665
  "location": {
15666
15666
  "filePath": "artifact/artifact-factory.ts",
15667
- "line": 46,
15667
+ "line": 47,
15668
15668
  "character": 19
15669
15669
  },
15670
15670
  "name": "undefined"
@@ -15677,7 +15677,7 @@
15677
15677
  "__schema": "FunctionLikeSchema",
15678
15678
  "location": {
15679
15679
  "filePath": "artifact/artifact-factory.ts",
15680
- "line": 69,
15680
+ "line": 70,
15681
15681
  "character": 3
15682
15682
  },
15683
15683
  "signature": "(method) ArtifactFactory.getRootDir(rootDir: string, def: ArtifactDefinition): string",
@@ -15687,7 +15687,7 @@
15687
15687
  "__schema": "ParameterSchema",
15688
15688
  "location": {
15689
15689
  "filePath": "artifact/artifact-factory.ts",
15690
- "line": 69,
15690
+ "line": 70,
15691
15691
  "character": 14
15692
15692
  },
15693
15693
  "name": "rootDir",
@@ -15695,7 +15695,7 @@
15695
15695
  "__schema": "KeywordTypeSchema",
15696
15696
  "location": {
15697
15697
  "filePath": "artifact/artifact-factory.ts",
15698
- "line": 69,
15698
+ "line": 70,
15699
15699
  "character": 23
15700
15700
  },
15701
15701
  "name": "string"
@@ -15707,7 +15707,7 @@
15707
15707
  "__schema": "ParameterSchema",
15708
15708
  "location": {
15709
15709
  "filePath": "artifact/artifact-factory.ts",
15710
- "line": 69,
15710
+ "line": 70,
15711
15711
  "character": 31
15712
15712
  },
15713
15713
  "name": "def",
@@ -15715,7 +15715,7 @@
15715
15715
  "__schema": "TypeRefSchema",
15716
15716
  "location": {
15717
15717
  "filePath": "artifact/artifact-factory.ts",
15718
- "line": 69,
15718
+ "line": 70,
15719
15719
  "character": 36
15720
15720
  },
15721
15721
  "name": "ArtifactDefinition"
@@ -15728,7 +15728,7 @@
15728
15728
  "__schema": "InferenceTypeSchema",
15729
15729
  "location": {
15730
15730
  "filePath": "artifact/artifact-factory.ts",
15731
- "line": 69,
15731
+ "line": 70,
15732
15732
  "character": 3
15733
15733
  },
15734
15734
  "type": "string"
@@ -15739,14 +15739,14 @@
15739
15739
  "__schema": "FunctionLikeSchema",
15740
15740
  "location": {
15741
15741
  "filePath": "artifact/artifact-factory.ts",
15742
- "line": 77,
15742
+ "line": 78,
15743
15743
  "character": 3
15744
15744
  },
15745
15745
  "doc": {
15746
15746
  "__schema": "DocSchema",
15747
15747
  "location": {
15748
15748
  "filePath": "artifact/artifact-factory.ts",
15749
- "line": 74,
15749
+ "line": 75,
15750
15750
  "character": 3
15751
15751
  },
15752
15752
  "raw": "/**\n * generate artifacts from a build context according to the spec defined in the artifact definitions.\n */",
@@ -15759,7 +15759,7 @@
15759
15759
  "__schema": "ParameterSchema",
15760
15760
  "location": {
15761
15761
  "filePath": "artifact/artifact-factory.ts",
15762
- "line": 77,
15762
+ "line": 78,
15763
15763
  "character": 12
15764
15764
  },
15765
15765
  "name": "context",
@@ -15767,7 +15767,7 @@
15767
15767
  "__schema": "TypeRefSchema",
15768
15768
  "location": {
15769
15769
  "filePath": "artifact/artifact-factory.ts",
15770
- "line": 77,
15770
+ "line": 78,
15771
15771
  "character": 21
15772
15772
  },
15773
15773
  "name": "BuildContext"
@@ -15779,7 +15779,7 @@
15779
15779
  "__schema": "ParameterSchema",
15780
15780
  "location": {
15781
15781
  "filePath": "artifact/artifact-factory.ts",
15782
- "line": 77,
15782
+ "line": 78,
15783
15783
  "character": 35
15784
15784
  },
15785
15785
  "name": "defs",
@@ -15787,14 +15787,14 @@
15787
15787
  "__schema": "TypeArraySchema",
15788
15788
  "location": {
15789
15789
  "filePath": "artifact/artifact-factory.ts",
15790
- "line": 77,
15790
+ "line": 78,
15791
15791
  "character": 41
15792
15792
  },
15793
15793
  "type": {
15794
15794
  "__schema": "TypeRefSchema",
15795
15795
  "location": {
15796
15796
  "filePath": "artifact/artifact-factory.ts",
15797
- "line": 77,
15797
+ "line": 78,
15798
15798
  "character": 41
15799
15799
  },
15800
15800
  "name": "ArtifactDefinition"
@@ -15807,7 +15807,7 @@
15807
15807
  "__schema": "ParameterSchema",
15808
15808
  "location": {
15809
15809
  "filePath": "artifact/artifact-factory.ts",
15810
- "line": 77,
15810
+ "line": 78,
15811
15811
  "character": 63
15812
15812
  },
15813
15813
  "name": "task",
@@ -15815,7 +15815,7 @@
15815
15815
  "__schema": "TypeRefSchema",
15816
15816
  "location": {
15817
15817
  "filePath": "artifact/artifact-factory.ts",
15818
- "line": 77,
15818
+ "line": 78,
15819
15819
  "character": 69
15820
15820
  },
15821
15821
  "name": "BuildTask"
@@ -15828,7 +15828,7 @@
15828
15828
  "__schema": "TypeRefSchema",
15829
15829
  "location": {
15830
15830
  "filePath": "artifact/artifact-factory.ts",
15831
- "line": 77,
15831
+ "line": 78,
15832
15832
  "character": 81
15833
15833
  },
15834
15834
  "name": "ComponentMap",
@@ -15841,7 +15841,7 @@
15841
15841
  "__schema": "TypeRefSchema",
15842
15842
  "location": {
15843
15843
  "filePath": "artifact/artifact-factory.ts",
15844
- "line": 77,
15844
+ "line": 78,
15845
15845
  "character": 94
15846
15846
  },
15847
15847
  "name": "ArtifactList",
@@ -15850,7 +15850,7 @@
15850
15850
  "__schema": "TypeRefSchema",
15851
15851
  "location": {
15852
15852
  "filePath": "artifact/artifact-factory.ts",
15853
- "line": 77,
15853
+ "line": 78,
15854
15854
  "character": 107
15855
15855
  },
15856
15856
  "name": "FsArtifact",
@@ -16658,7 +16658,7 @@
16658
16658
  "_legacy": {
16659
16659
  "scope": "teambit.pipelines",
16660
16660
  "name": "builder",
16661
- "version": "1.0.269"
16661
+ "version": "1.0.271"
16662
16662
  },
16663
16663
  "_scope": "teambit.pipelines"
16664
16664
  }
@@ -16943,7 +16943,7 @@
16943
16943
  "componentId": {
16944
16944
  "scope": "teambit.pipelines",
16945
16945
  "name": "builder",
16946
- "version": "1.0.269"
16946
+ "version": "1.0.271"
16947
16947
  },
16948
16948
  "taggedModuleExports": []
16949
16949
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","require","_globby","_interopRequireDefault","_lodash","_artifactFiles","_component","_utils","_storage","_artifactList","_exceptions","_fsArtifact","obj","__esModule","default","DEFAULT_CONTEXT","exports","ArtifactFactory","resolvePaths","root","def","patternsFlattened","flatten","globPatterns","patternsFlattenedLinux","map","pathNormalizeToLinux","paths","globby","sync","cwd","getArtifactContextPath","context","component","artifactContext","getArtifactContext","capsulePath","capsuleNetwork","graphCapsules","getCapsule","id","path","CapsuleNotFound","capsulesRootDir","createFromComponent","task","contextPath","rootDir","getRootDir","length","undefined","FsArtifact","ArtifactFiles","getStorageResolver","storageResolver","DefaultResolver","toComponentMap","artifactMap","ComponentMap","as","components","toString","artifacts","filter","targetId","artifact","ArtifactList","fromArray","join","generate","defs","tupleArr","forEach","capsuleDir","push"],"sources":["artifact-factory.ts"],"sourcesContent":["import { join } from 'path';\nimport globby from 'globby';\nimport { flatten } from 'lodash';\nimport { ArtifactFiles } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { Component, ComponentMap } from '@teambit/component';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { ArtifactDefinition } from './artifact-definition';\nimport { DefaultResolver } from '../storage';\nimport { ArtifactList } from './artifact-list';\nimport type { BuildContext, BuildTask } from '../build-task';\nimport { CapsuleNotFound } from '../exceptions';\nimport { FsArtifact } from './fs-artifact';\n\nexport const DEFAULT_CONTEXT = 'component';\n\nexport type ArtifactMap = ComponentMap<ArtifactList<FsArtifact>>;\n\nexport class ArtifactFactory {\n resolvePaths(root: string, def: ArtifactDefinition): string[] {\n const patternsFlattened = flatten(def.globPatterns);\n const patternsFlattenedLinux = patternsFlattened.map(pathNormalizeToLinux);\n const paths = globby.sync(patternsFlattenedLinux, { cwd: root });\n return paths;\n }\n\n private getArtifactContextPath(context: BuildContext, component: Component, def: ArtifactDefinition) {\n const artifactContext = this.getArtifactContext(def);\n if (artifactContext === 'component') {\n const capsulePath = context.capsuleNetwork.graphCapsules.getCapsule(component.id)?.path;\n if (!capsulePath) throw new CapsuleNotFound(component.id);\n return capsulePath;\n }\n\n return context.capsuleNetwork.capsulesRootDir;\n }\n\n private getArtifactContext(def: ArtifactDefinition) {\n return def.context || DEFAULT_CONTEXT;\n }\n\n createFromComponent(\n context: BuildContext,\n component: Component,\n def: ArtifactDefinition,\n task: BuildTask\n ): FsArtifact | undefined {\n const contextPath = this.getArtifactContextPath(context, component, def);\n const rootDir = this.getRootDir(contextPath, def);\n const paths = this.resolvePaths(rootDir, def);\n if (!paths || !paths.length) {\n return undefined;\n }\n return new FsArtifact(def, new ArtifactFiles(paths), task, rootDir);\n }\n\n private getStorageResolver(def: ArtifactDefinition) {\n return def.storageResolver || new DefaultResolver();\n }\n\n private toComponentMap(context: BuildContext, artifactMap: [string, FsArtifact][]) {\n return ComponentMap.as<ArtifactList<FsArtifact>>(context.components, (component) => {\n const id = component.id.toString();\n const artifacts = artifactMap.filter(([targetId]) => targetId === id).map(([, artifact]) => artifact);\n\n return ArtifactList.fromArray(artifacts);\n });\n }\n\n getRootDir(rootDir: string, def: ArtifactDefinition) {\n if (!def.rootDir) return rootDir;\n return join(rootDir, def.rootDir);\n }\n\n /**\n * generate artifacts from a build context according to the spec defined in the artifact definitions.\n */\n generate(context: BuildContext, defs: ArtifactDefinition[], task: BuildTask): ComponentMap<ArtifactList<FsArtifact>> {\n const tupleArr: [string, FsArtifact][] = [];\n\n defs.forEach((def) => {\n const artifactContext = this.getArtifactContext(def);\n if (artifactContext === 'env') {\n const capsuleDir = context.capsuleNetwork.capsulesRootDir;\n const rootDir = this.getRootDir(capsuleDir, def);\n const paths = this.resolvePaths(rootDir, def);\n if (paths && paths.length) {\n const artifact = new FsArtifact(def, new ArtifactFiles(this.resolvePaths(rootDir, def)), task, rootDir);\n\n return context.components.forEach((component) => {\n tupleArr.push([component.id.toString(), artifact]);\n });\n }\n }\n\n return context.components.forEach((component) => {\n const artifact = this.createFromComponent(context, component, def, task);\n if (artifact) {\n tupleArr.push([component.id.toString(), artifact]);\n }\n });\n });\n\n return this.toComponentMap(context, tupleArr);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,eAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,cAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;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AAO,CAAEvC,SAAS,IAAK;QAC/C,MAAMgC,QAAQ,GAAG,IAAI,CAACrB,mBAAmB,CAACZ,OAAO,EAAEC,SAAS,EAAEb,GAAG,EAAEyB,IAAI,CAAC;QACxE,IAAIoB,QAAQ,EAAE;UACZM,QAAQ,CAACG,IAAI,CAAC,CAACzC,SAAS,CAACO,EAAE,CAACqB,QAAQ,CAAC,CAAC,EAAEI,QAAQ,CAAC,CAAC;QACpD;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI,CAACT,cAAc,CAACxB,OAAO,EAAEuC,QAAQ,CAAC;EAC/C;AACF;AAACvD,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","require","_globby","_interopRequireDefault","_lodash","_artifactFiles","_component","_utils","_storage","_artifactList","_exceptions","_fsArtifact","obj","__esModule","default","DEFAULT_CONTEXT","exports","ArtifactFactory","resolvePaths","root","def","patternsFlattened","flatten","globPatterns","patternsFlattenedLinux","map","pathNormalizeToLinux","paths","globby","sync","cwd","getArtifactContextPath","context","component","artifactContext","getArtifactContext","capsulePath","capsuleNetwork","graphCapsules","getCapsule","id","path","CapsuleNotFound","capsulesRootDir","createFromComponent","task","contextPath","rootDir","getRootDir","length","undefined","FsArtifact","ArtifactFiles","getStorageResolver","storageResolver","DefaultResolver","toComponentMap","artifactMap","ComponentMap","as","components","toString","artifacts","filter","targetId","artifact","ArtifactList","fromArray","join","generate","defs","tupleArr","forEach","capsuleDir","push"],"sources":["artifact-factory.ts"],"sourcesContent":["import { join } from 'path';\nimport globby from 'globby';\nimport { flatten } from 'lodash';\nimport { ArtifactFiles } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { Component, ComponentMap } from '@teambit/component';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { PathLinux } from '@teambit/legacy/dist/utils/path';\nimport { ArtifactDefinition } from './artifact-definition';\nimport { DefaultResolver } from '../storage';\nimport { ArtifactList } from './artifact-list';\nimport type { BuildContext, BuildTask } from '../build-task';\nimport { CapsuleNotFound } from '../exceptions';\nimport { FsArtifact } from './fs-artifact';\n\nexport const DEFAULT_CONTEXT = 'component';\n\nexport type ArtifactMap = ComponentMap<ArtifactList<FsArtifact>>;\n\nexport class ArtifactFactory {\n resolvePaths(root: string, def: ArtifactDefinition): string[] {\n const patternsFlattened = flatten(def.globPatterns);\n const patternsFlattenedLinux: PathLinux[] = patternsFlattened.map(pathNormalizeToLinux);\n const paths = globby.sync(patternsFlattenedLinux, { cwd: root });\n return paths;\n }\n\n private getArtifactContextPath(context: BuildContext, component: Component, def: ArtifactDefinition) {\n const artifactContext = this.getArtifactContext(def);\n if (artifactContext === 'component') {\n const capsulePath = context.capsuleNetwork.graphCapsules.getCapsule(component.id)?.path;\n if (!capsulePath) throw new CapsuleNotFound(component.id);\n return capsulePath;\n }\n\n return context.capsuleNetwork.capsulesRootDir;\n }\n\n private getArtifactContext(def: ArtifactDefinition) {\n return def.context || DEFAULT_CONTEXT;\n }\n\n createFromComponent(\n context: BuildContext,\n component: Component,\n def: ArtifactDefinition,\n task: BuildTask\n ): FsArtifact | undefined {\n const contextPath = this.getArtifactContextPath(context, component, def);\n const rootDir = this.getRootDir(contextPath, def);\n const paths = this.resolvePaths(rootDir, def);\n if (!paths || !paths.length) {\n return undefined;\n }\n return new FsArtifact(def, new ArtifactFiles(paths), task, rootDir);\n }\n\n private getStorageResolver(def: ArtifactDefinition) {\n return def.storageResolver || new DefaultResolver();\n }\n\n private toComponentMap(context: BuildContext, artifactMap: [string, FsArtifact][]) {\n return ComponentMap.as<ArtifactList<FsArtifact>>(context.components, (component) => {\n const id = component.id.toString();\n const artifacts = artifactMap.filter(([targetId]) => targetId === id).map(([, artifact]) => artifact);\n\n return ArtifactList.fromArray(artifacts);\n });\n }\n\n getRootDir(rootDir: string, def: ArtifactDefinition) {\n if (!def.rootDir) return rootDir;\n return join(rootDir, def.rootDir);\n }\n\n /**\n * generate artifacts from a build context according to the spec defined in the artifact definitions.\n */\n generate(context: BuildContext, defs: ArtifactDefinition[], task: BuildTask): ComponentMap<ArtifactList<FsArtifact>> {\n const tupleArr: [string, FsArtifact][] = [];\n\n defs.forEach((def) => {\n const artifactContext = this.getArtifactContext(def);\n if (artifactContext === 'env') {\n const capsuleDir = context.capsuleNetwork.capsulesRootDir;\n const rootDir = this.getRootDir(capsuleDir, def);\n const paths = this.resolvePaths(rootDir, def);\n if (paths && paths.length) {\n const artifact = new FsArtifact(def, new ArtifactFiles(this.resolvePaths(rootDir, def)), task, rootDir);\n\n return context.components.forEach((component) => {\n tupleArr.push([component.id.toString(), artifact]);\n });\n }\n }\n\n return context.components.forEach((component) => {\n const artifact = this.createFromComponent(context, component, def, task);\n if (artifact) {\n tupleArr.push([component.id.toString(), artifact]);\n }\n });\n });\n\n return this.toComponentMap(context, tupleArr);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,eAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,cAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAA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AAU,CAACY,OAAO,CAAEvC,SAAS,IAAK;YAC/CsC,QAAQ,CAACG,IAAI,CAAC,CAACzC,SAAS,CAACO,EAAE,CAACqB,QAAQ,CAAC,CAAC,EAAEI,QAAQ,CAAC,CAAC;UACpD,CAAC,CAAC;QACJ;MACF;MAEA,OAAOjC,OAAO,CAAC4B,UAAU,CAACY,OAAO,CAAEvC,SAAS,IAAK;QAC/C,MAAMgC,QAAQ,GAAG,IAAI,CAACrB,mBAAmB,CAACZ,OAAO,EAAEC,SAAS,EAAEb,GAAG,EAAEyB,IAAI,CAAC;QACxE,IAAIoB,QAAQ,EAAE;UACZM,QAAQ,CAACG,IAAI,CAAC,CAACzC,SAAS,CAACO,EAAE,CAACqB,QAAQ,CAAC,CAAC,EAAEI,QAAQ,CAAC,CAAC;QACpD;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI,CAACT,cAAc,CAACxB,OAAO,EAAEuC,QAAQ,CAAC;EAC/C;AACF;AAACvD,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.269/dist/builder.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.269/dist/builder.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.271/dist/builder.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.271/dist/builder.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/builder",
3
- "version": "1.0.269",
3
+ "version": "1.0.271",
4
4
  "homepage": "https://bit.cloud/teambit/pipelines/builder",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.pipelines",
8
8
  "name": "builder",
9
- "version": "1.0.269"
9
+ "version": "1.0.271"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -26,22 +26,22 @@
26
26
  "@teambit/harmony": "0.4.6",
27
27
  "@teambit/bit-error": "0.0.404",
28
28
  "@teambit/component-id": "1.2.0",
29
- "@teambit/component": "1.0.269",
30
- "@teambit/envs": "1.0.269",
29
+ "@teambit/component": "1.0.271",
30
+ "@teambit/envs": "1.0.271",
31
31
  "@teambit/logger": "0.0.958",
32
32
  "@teambit/toolbox.string.capitalize": "0.0.496",
33
- "@teambit/tester": "1.0.269",
34
- "@teambit/isolator": "1.0.269",
33
+ "@teambit/tester": "1.0.271",
34
+ "@teambit/isolator": "1.0.271",
35
35
  "@teambit/cli": "0.0.865",
36
- "@teambit/workspace": "1.0.269",
37
- "@teambit/aspect-loader": "1.0.269",
38
- "@teambit/aspect": "1.0.269",
39
- "@teambit/generator": "1.0.270",
36
+ "@teambit/workspace": "1.0.271",
37
+ "@teambit/aspect-loader": "1.0.271",
38
+ "@teambit/aspect": "1.0.271",
39
+ "@teambit/generator": "1.0.272",
40
40
  "@teambit/global-config": "0.0.868",
41
- "@teambit/graphql": "1.0.269",
42
- "@teambit/scope": "1.0.269",
41
+ "@teambit/graphql": "1.0.271",
42
+ "@teambit/scope": "1.0.271",
43
43
  "@teambit/toolbox.array.duplications-finder": "0.0.1",
44
- "@teambit/ui": "1.0.269",
44
+ "@teambit/ui": "1.0.271",
45
45
  "@teambit/express": "0.0.964"
46
46
  },
47
47
  "devDependencies": {