@teambit/builder 1.0.492 → 1.0.493
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_pipelines_builder-preview.js +1 -1
- package/artifacts/schema.json +33 -33
- package/dist/{preview-1733950992344.js → preview-1734020193676.js} +2 -2
- package/package.json +24 -24
- package/dist/storage/s3-resolver.d.ts +0 -0
- package/dist/storage/s3-resolver.js +0 -43
- package/dist/storage/s3-resolver.js.map +0 -1
- package/storage/s3-resolver.ts +0 -40
@@ -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.
|
3
|
+
<testsuite name="teambit.pipelines/builder@1.0.493" 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={8513:(e,n,t)=>{var i={id:"teambit.pipelines/aspect-docs/builder@0.0.170",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,o(t(1594));var a=t(5016),r=["components"];function o(e){return e&&e.__esModule?e:{default:e}}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)({}).hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l.apply(null,arguments)}function s(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.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function d(e,n){if(null==e)return{};var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;t[i]=e[i]}return t}o.__bit_component=i,l.__bit_component=i,s.__bit_component=i,d.__bit_component=i;var p={},m="wrapper";function u(e){var n=e.components,t=s(e,r);return(0,a.mdx)(m,l({},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(\n readonly aspectId: string,\n readonly name: string\n ) {}\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(\n readonly aspectId: string,\n readonly name: string\n ) {}\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},8331:(e,n,t)=>{Object.defineProperty(n,"M",{enumerable:!0,get:function(){return i.default}});var i=a(t(8513));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.pipelines/aspect-docs/builder@0.0.170",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0}},2657:(e,n,t)=>{var i={id:"teambit.pipelines/builder@1.0.492",homepage:"https://bit.cloud/teambit/pipelines/builder",exported:!0};function a(){const e=r(t(1594));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},1594: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={};t.r(i),t.d(i,{compositions:()=>h,compositions_metadata:()=>b,overview:()=>x});var a={};t.r(a),t.d(a,{default:()=>c});var r=t(2657),o=(t(1594),t(5016));const l=TeambitMdxUiMdxScopeContext;var s=t(8331),d=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)({}).hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},p.apply(null,arguments)}var m={},u="wrapper";function c(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({}.hasOwnProperty.call(e,i)){if(n.includes(i))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.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}(e,d);return(0,o.mdx)(u,p({},m,t,{components:n,mdxType:"MDXLayout"}),(0,o.mdx)(l.MDXScopeProvider,{components:{Builder:s.M},mdxType:"MDXScopeProvider"},(0,o.mdx)(s.M,{mdxType:"Builder"})))}c.isMDXComponent=!0;const h=[r],x=[a],b={compositions:[{displayName:"Logo",identifier:"Logo"}]};return 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={894:(e,n,t)=>{var i={id:"teambit.pipelines/aspect-docs/builder@0.0.170",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,o(t(1594));var a=t(5016),r=["components"];function o(e){return e&&e.__esModule?e:{default:e}}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)({}).hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l.apply(null,arguments)}function s(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.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function d(e,n){if(null==e)return{};var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;t[i]=e[i]}return t}o.__bit_component=i,l.__bit_component=i,s.__bit_component=i,d.__bit_component=i;var p={},m="wrapper";function u(e){var n=e.components,t=s(e,r);return(0,a.mdx)(m,l({},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(\n readonly aspectId: string,\n readonly name: string\n ) {}\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(\n readonly aspectId: string,\n readonly name: string\n ) {}\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},8331:(e,n,t)=>{Object.defineProperty(n,"M",{enumerable:!0,get:function(){return i.default}});var i=a(t(894));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.pipelines/aspect-docs/builder@0.0.170",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0}},8708:(e,n,t)=>{var i={id:"teambit.pipelines/builder@1.0.493",homepage:"https://bit.cloud/teambit/pipelines/builder",exported:!0};function a(){const e=r(t(1594));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},1594: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={};t.r(i),t.d(i,{compositions:()=>h,compositions_metadata:()=>b,overview:()=>x});var a={};t.r(a),t.d(a,{default:()=>c});var r=t(8708),o=(t(1594),t(5016));const l=TeambitMdxUiMdxScopeContext;var s=t(8331),d=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)({}).hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},p.apply(null,arguments)}var m={},u="wrapper";function c(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({}.hasOwnProperty.call(e,i)){if(n.includes(i))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.includes(t)||{}.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}(e,d);return(0,o.mdx)(u,p({},m,t,{components:n,mdxType:"MDXLayout"}),(0,o.mdx)(l.MDXScopeProvider,{components:{Builder:s.M},mdxType:"MDXScopeProvider"},(0,o.mdx)(s.M,{mdxType:"Builder"})))}c.isMDXComponent=!0;const h=[r],x=[a],b={compositions:[{displayName:"Logo",identifier:"Logo"}]};return i})()));
|
package/artifacts/schema.json
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
"componentId": {
|
34
34
|
"scope": "teambit.component",
|
35
35
|
"name": "sources",
|
36
|
-
"version": "0.0.
|
36
|
+
"version": "0.0.57"
|
37
37
|
}
|
38
38
|
}
|
39
39
|
},
|
@@ -1146,7 +1146,7 @@
|
|
1146
1146
|
"_legacy": {
|
1147
1147
|
"scope": "teambit.pipelines",
|
1148
1148
|
"name": "builder",
|
1149
|
-
"version": "1.0.
|
1149
|
+
"version": "1.0.493"
|
1150
1150
|
},
|
1151
1151
|
"_scope": "teambit.pipelines"
|
1152
1152
|
}
|
@@ -1661,7 +1661,7 @@
|
|
1661
1661
|
"line": 7,
|
1662
1662
|
"character": 57
|
1663
1663
|
},
|
1664
|
-
"signature": "type TaskLocation = \"
|
1664
|
+
"signature": "type TaskLocation = \"start\" | \"end\"",
|
1665
1665
|
"name": "TaskLocation",
|
1666
1666
|
"exportNode": {
|
1667
1667
|
"__schema": "TypeSchema",
|
@@ -1670,7 +1670,7 @@
|
|
1670
1670
|
"line": 11,
|
1671
1671
|
"character": 1
|
1672
1672
|
},
|
1673
|
-
"signature": "type TaskLocation = \"
|
1673
|
+
"signature": "type TaskLocation = \"start\" | \"end\"",
|
1674
1674
|
"name": "TaskLocation",
|
1675
1675
|
"type": {
|
1676
1676
|
"__schema": "TypeUnionSchema",
|
@@ -2555,7 +2555,7 @@
|
|
2555
2555
|
"componentId": {
|
2556
2556
|
"scope": "teambit.component",
|
2557
2557
|
"name": "sources",
|
2558
|
-
"version": "0.0.
|
2558
|
+
"version": "0.0.57"
|
2559
2559
|
}
|
2560
2560
|
}
|
2561
2561
|
}
|
@@ -2667,7 +2667,7 @@
|
|
2667
2667
|
"componentId": {
|
2668
2668
|
"scope": "teambit.component",
|
2669
2669
|
"name": "sources",
|
2670
|
-
"version": "0.0.
|
2670
|
+
"version": "0.0.57"
|
2671
2671
|
}
|
2672
2672
|
}
|
2673
2673
|
}
|
@@ -2779,7 +2779,7 @@
|
|
2779
2779
|
"componentId": {
|
2780
2780
|
"scope": "teambit.component",
|
2781
2781
|
"name": "sources",
|
2782
|
-
"version": "0.0.
|
2782
|
+
"version": "0.0.57"
|
2783
2783
|
}
|
2784
2784
|
}
|
2785
2785
|
}
|
@@ -4633,7 +4633,7 @@
|
|
4633
4633
|
"componentId": {
|
4634
4634
|
"scope": "teambit.component",
|
4635
4635
|
"name": "sources",
|
4636
|
-
"version": "0.0.
|
4636
|
+
"version": "0.0.57"
|
4637
4637
|
}
|
4638
4638
|
}
|
4639
4639
|
},
|
@@ -6134,7 +6134,7 @@
|
|
6134
6134
|
"componentId": {
|
6135
6135
|
"scope": "teambit.component",
|
6136
6136
|
"name": "sources",
|
6137
|
-
"version": "0.0.
|
6137
|
+
"version": "0.0.57"
|
6138
6138
|
}
|
6139
6139
|
},
|
6140
6140
|
"isOptional": false,
|
@@ -6832,7 +6832,7 @@
|
|
6832
6832
|
"componentId": {
|
6833
6833
|
"scope": "teambit.component",
|
6834
6834
|
"name": "sources",
|
6835
|
-
"version": "0.0.
|
6835
|
+
"version": "0.0.57"
|
6836
6836
|
}
|
6837
6837
|
},
|
6838
6838
|
"isOptional": false,
|
@@ -7099,7 +7099,7 @@
|
|
7099
7099
|
"componentId": {
|
7100
7100
|
"scope": "teambit.component",
|
7101
7101
|
"name": "sources",
|
7102
|
-
"version": "0.0.
|
7102
|
+
"version": "0.0.57"
|
7103
7103
|
}
|
7104
7104
|
},
|
7105
7105
|
"modifiers": []
|
@@ -7133,7 +7133,7 @@
|
|
7133
7133
|
"componentId": {
|
7134
7134
|
"scope": "teambit.component",
|
7135
7135
|
"name": "sources",
|
7136
|
-
"version": "0.0.
|
7136
|
+
"version": "0.0.57"
|
7137
7137
|
}
|
7138
7138
|
},
|
7139
7139
|
"isOptional": false,
|
@@ -7560,7 +7560,7 @@
|
|
7560
7560
|
"componentId": {
|
7561
7561
|
"scope": "teambit.component",
|
7562
7562
|
"name": "sources",
|
7563
|
-
"version": "0.0.
|
7563
|
+
"version": "0.0.57"
|
7564
7564
|
}
|
7565
7565
|
}
|
7566
7566
|
},
|
@@ -7641,7 +7641,7 @@
|
|
7641
7641
|
"componentId": {
|
7642
7642
|
"scope": "teambit.legacy",
|
7643
7643
|
"name": "scope",
|
7644
|
-
"version": "0.0.
|
7644
|
+
"version": "0.0.5"
|
7645
7645
|
}
|
7646
7646
|
},
|
7647
7647
|
"isOptional": false,
|
@@ -7675,7 +7675,7 @@
|
|
7675
7675
|
"componentId": {
|
7676
7676
|
"scope": "teambit.component",
|
7677
7677
|
"name": "sources",
|
7678
|
-
"version": "0.0.
|
7678
|
+
"version": "0.0.57"
|
7679
7679
|
}
|
7680
7680
|
}
|
7681
7681
|
}
|
@@ -7780,7 +7780,7 @@
|
|
7780
7780
|
"componentId": {
|
7781
7781
|
"scope": "teambit.component",
|
7782
7782
|
"name": "sources",
|
7783
|
-
"version": "0.0.
|
7783
|
+
"version": "0.0.57"
|
7784
7784
|
}
|
7785
7785
|
}
|
7786
7786
|
},
|
@@ -7903,7 +7903,7 @@
|
|
7903
7903
|
"_legacy": {
|
7904
7904
|
"scope": "teambit.pipelines",
|
7905
7905
|
"name": "builder",
|
7906
|
-
"version": "1.0.
|
7906
|
+
"version": "1.0.493"
|
7907
7907
|
},
|
7908
7908
|
"_scope": "teambit.pipelines"
|
7909
7909
|
}
|
@@ -9909,7 +9909,7 @@
|
|
9909
9909
|
"line": 11,
|
9910
9910
|
"character": 1
|
9911
9911
|
},
|
9912
|
-
"signature": "type TaskLocation = \"
|
9912
|
+
"signature": "type TaskLocation = \"start\" | \"end\"",
|
9913
9913
|
"name": "TaskLocation",
|
9914
9914
|
"type": {
|
9915
9915
|
"__schema": "TypeUnionSchema",
|
@@ -10230,7 +10230,7 @@
|
|
10230
10230
|
"_legacy": {
|
10231
10231
|
"scope": "teambit.pipelines",
|
10232
10232
|
"name": "builder",
|
10233
|
-
"version": "1.0.
|
10233
|
+
"version": "1.0.493"
|
10234
10234
|
},
|
10235
10235
|
"_scope": "teambit.pipelines"
|
10236
10236
|
}
|
@@ -11485,7 +11485,7 @@
|
|
11485
11485
|
"componentId": {
|
11486
11486
|
"scope": "teambit.component",
|
11487
11487
|
"name": "sources",
|
11488
|
-
"version": "0.0.
|
11488
|
+
"version": "0.0.57"
|
11489
11489
|
}
|
11490
11490
|
}
|
11491
11491
|
},
|
@@ -12400,7 +12400,7 @@
|
|
12400
12400
|
"componentId": {
|
12401
12401
|
"scope": "teambit.component",
|
12402
12402
|
"name": "sources",
|
12403
|
-
"version": "0.0.
|
12403
|
+
"version": "0.0.57"
|
12404
12404
|
}
|
12405
12405
|
}
|
12406
12406
|
}
|
@@ -12512,7 +12512,7 @@
|
|
12512
12512
|
"componentId": {
|
12513
12513
|
"scope": "teambit.component",
|
12514
12514
|
"name": "sources",
|
12515
|
-
"version": "0.0.
|
12515
|
+
"version": "0.0.57"
|
12516
12516
|
}
|
12517
12517
|
}
|
12518
12518
|
}
|
@@ -12624,7 +12624,7 @@
|
|
12624
12624
|
"componentId": {
|
12625
12625
|
"scope": "teambit.component",
|
12626
12626
|
"name": "sources",
|
12627
|
-
"version": "0.0.
|
12627
|
+
"version": "0.0.57"
|
12628
12628
|
}
|
12629
12629
|
}
|
12630
12630
|
}
|
@@ -15298,7 +15298,7 @@
|
|
15298
15298
|
"componentId": {
|
15299
15299
|
"scope": "teambit.component",
|
15300
15300
|
"name": "sources",
|
15301
|
-
"version": "0.0.
|
15301
|
+
"version": "0.0.57"
|
15302
15302
|
}
|
15303
15303
|
},
|
15304
15304
|
"isOptional": false,
|
@@ -15566,7 +15566,7 @@
|
|
15566
15566
|
"componentId": {
|
15567
15567
|
"scope": "teambit.component",
|
15568
15568
|
"name": "sources",
|
15569
|
-
"version": "0.0.
|
15569
|
+
"version": "0.0.57"
|
15570
15570
|
}
|
15571
15571
|
},
|
15572
15572
|
"isOptional": false,
|
@@ -15833,7 +15833,7 @@
|
|
15833
15833
|
"componentId": {
|
15834
15834
|
"scope": "teambit.component",
|
15835
15835
|
"name": "sources",
|
15836
|
-
"version": "0.0.
|
15836
|
+
"version": "0.0.57"
|
15837
15837
|
}
|
15838
15838
|
},
|
15839
15839
|
"modifiers": []
|
@@ -15867,7 +15867,7 @@
|
|
15867
15867
|
"componentId": {
|
15868
15868
|
"scope": "teambit.component",
|
15869
15869
|
"name": "sources",
|
15870
|
-
"version": "0.0.
|
15870
|
+
"version": "0.0.57"
|
15871
15871
|
}
|
15872
15872
|
},
|
15873
15873
|
"isOptional": false,
|
@@ -16838,7 +16838,7 @@
|
|
16838
16838
|
"componentId": {
|
16839
16839
|
"scope": "teambit.component",
|
16840
16840
|
"name": "sources",
|
16841
|
-
"version": "0.0.
|
16841
|
+
"version": "0.0.57"
|
16842
16842
|
}
|
16843
16843
|
}
|
16844
16844
|
},
|
@@ -16919,7 +16919,7 @@
|
|
16919
16919
|
"componentId": {
|
16920
16920
|
"scope": "teambit.legacy",
|
16921
16921
|
"name": "scope",
|
16922
|
-
"version": "0.0.
|
16922
|
+
"version": "0.0.5"
|
16923
16923
|
}
|
16924
16924
|
},
|
16925
16925
|
"isOptional": false,
|
@@ -16953,7 +16953,7 @@
|
|
16953
16953
|
"componentId": {
|
16954
16954
|
"scope": "teambit.component",
|
16955
16955
|
"name": "sources",
|
16956
|
-
"version": "0.0.
|
16956
|
+
"version": "0.0.57"
|
16957
16957
|
}
|
16958
16958
|
}
|
16959
16959
|
}
|
@@ -17058,7 +17058,7 @@
|
|
17058
17058
|
"componentId": {
|
17059
17059
|
"scope": "teambit.component",
|
17060
17060
|
"name": "sources",
|
17061
|
-
"version": "0.0.
|
17061
|
+
"version": "0.0.57"
|
17062
17062
|
}
|
17063
17063
|
}
|
17064
17064
|
},
|
@@ -17181,7 +17181,7 @@
|
|
17181
17181
|
"_legacy": {
|
17182
17182
|
"scope": "teambit.pipelines",
|
17183
17183
|
"name": "builder",
|
17184
|
-
"version": "1.0.
|
17184
|
+
"version": "1.0.493"
|
17185
17185
|
},
|
17186
17186
|
"_scope": "teambit.pipelines"
|
17187
17187
|
}
|
@@ -17467,7 +17467,7 @@
|
|
17467
17467
|
"componentId": {
|
17468
17468
|
"scope": "teambit.pipelines",
|
17469
17469
|
"name": "builder",
|
17470
|
-
"version": "1.0.
|
17470
|
+
"version": "1.0.493"
|
17471
17471
|
},
|
17472
17472
|
"taggedModuleExports": []
|
17473
17473
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.493/dist/builder.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.pipelines_builder@1.0.493/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.
|
3
|
+
"version": "1.0.493",
|
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.
|
9
|
+
"version": "1.0.493"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "2.4.2",
|
@@ -26,31 +26,31 @@
|
|
26
26
|
"@teambit/harmony": "0.4.6",
|
27
27
|
"@teambit/bit-error": "0.0.404",
|
28
28
|
"@teambit/component-id": "1.2.2",
|
29
|
-
"@teambit/component": "1.0.
|
30
|
-
"@teambit/envs": "1.0.
|
31
|
-
"@teambit/logger": "0.0.
|
29
|
+
"@teambit/component": "1.0.493",
|
30
|
+
"@teambit/envs": "1.0.493",
|
31
|
+
"@teambit/logger": "0.0.1163",
|
32
32
|
"@teambit/toolbox.string.capitalize": "0.0.497",
|
33
|
-
"@teambit/tester": "1.0.
|
34
|
-
"@teambit/component.sources": "0.0.
|
35
|
-
"@teambit/isolator": "1.0.
|
36
|
-
"@teambit/cli": "0.0.
|
33
|
+
"@teambit/tester": "1.0.493",
|
34
|
+
"@teambit/component.sources": "0.0.57",
|
35
|
+
"@teambit/isolator": "1.0.493",
|
36
|
+
"@teambit/cli": "0.0.1070",
|
37
37
|
"@teambit/component-issues": "0.0.152",
|
38
|
-
"@teambit/legacy.constants": "0.0.
|
39
|
-
"@teambit/workspace": "1.0.
|
40
|
-
"@teambit/aspect-loader": "1.0.
|
41
|
-
"@teambit/aspect": "1.0.
|
42
|
-
"@teambit/bit.get-bit-version": "0.0.
|
43
|
-
"@teambit/generator": "1.0.
|
44
|
-
"@teambit/global-config": "0.0.
|
45
|
-
"@teambit/graphql": "1.0.
|
46
|
-
"@teambit/issues": "1.0.
|
47
|
-
"@teambit/legacy.consumer-component": "0.0.
|
48
|
-
"@teambit/scope": "1.0.
|
38
|
+
"@teambit/legacy.constants": "0.0.3",
|
39
|
+
"@teambit/workspace": "1.0.493",
|
40
|
+
"@teambit/aspect-loader": "1.0.493",
|
41
|
+
"@teambit/aspect": "1.0.493",
|
42
|
+
"@teambit/bit.get-bit-version": "0.0.2",
|
43
|
+
"@teambit/generator": "1.0.494",
|
44
|
+
"@teambit/global-config": "0.0.1073",
|
45
|
+
"@teambit/graphql": "1.0.493",
|
46
|
+
"@teambit/issues": "1.0.493",
|
47
|
+
"@teambit/legacy.consumer-component": "0.0.6",
|
48
|
+
"@teambit/scope": "1.0.493",
|
49
49
|
"@teambit/toolbox.array.duplications-finder": "0.0.2",
|
50
|
-
"@teambit/ui": "1.0.
|
51
|
-
"@teambit/express": "0.0.
|
52
|
-
"@teambit/legacy.utils": "0.0.
|
53
|
-
"@teambit/legacy.scope": "0.0.
|
50
|
+
"@teambit/ui": "1.0.493",
|
51
|
+
"@teambit/express": "0.0.1169",
|
52
|
+
"@teambit/legacy.utils": "0.0.11",
|
53
|
+
"@teambit/legacy.scope": "0.0.5"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
56
|
"@types/pretty-time": "^1.1.5",
|
File without changes
|
@@ -1,43 +0,0 @@
|
|
1
|
-
// import { S3 } from 'aws-sdk';
|
2
|
-
// import { Component, ComponentID } from '@teambit/component';
|
3
|
-
// import { StorageResolver } from './storage-resolver';
|
4
|
-
// import type { ArtifactList } from '../artifact';
|
5
|
-
|
6
|
-
// export class S3Resolver implements StorageResolver {
|
7
|
-
// name = 's3';
|
8
|
-
// // todo artifact map
|
9
|
-
// async store(component: Component, artifacts: ArtifactList) {
|
10
|
-
// // https://staoge.com/{compId}/aspectId/${path}
|
11
|
-
// const artifactsByTaskId = artifacts.groupByTaskId();
|
12
|
-
// const files = Object.entries(artifactsByTaskId).map(([taskId, artifact]) => {
|
13
|
-
// return artifact.paths.map((path) => this.buildKey(component.id, taskId, path));
|
14
|
-
// });
|
15
|
-
// // files file to upload
|
16
|
-
// }
|
17
|
-
|
18
|
-
// private buildKey(id: ComponentID, taskId: string, path: string) {
|
19
|
-
// return id.fullName;
|
20
|
-
// }
|
21
|
-
|
22
|
-
// private upload(key: string, body: string) {
|
23
|
-
// const s3 = this.getS3Client();
|
24
|
-
// s3.upload({
|
25
|
-
// Bucket: 'storage',
|
26
|
-
// Key: key,
|
27
|
-
// Body: body,
|
28
|
-
// });
|
29
|
-
// }
|
30
|
-
|
31
|
-
// private getS3Client() {
|
32
|
-
// //TODO: need to pass bithub token
|
33
|
-
// const s3 = new S3({
|
34
|
-
// accessKeyId: 'bit',
|
35
|
-
// secretAccessKey: process.env.BIT_DEV_TOKEN,
|
36
|
-
// endpoint: 'http://bit.test:5003',
|
37
|
-
// });
|
38
|
-
// return s3;
|
39
|
-
// }
|
40
|
-
// }
|
41
|
-
"use strict";
|
42
|
-
|
43
|
-
//# sourceMappingURL=s3-resolver.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["s3-resolver.ts"],"sourcesContent":["// import { S3 } from 'aws-sdk';\n// import { Component, ComponentID } from '@teambit/component';\n// import { StorageResolver } from './storage-resolver';\n// import type { ArtifactList } from '../artifact';\n\n// export class S3Resolver implements StorageResolver {\n// name = 's3';\n// // todo artifact map\n// async store(component: Component, artifacts: ArtifactList) {\n// // https://staoge.com/{compId}/aspectId/${path}\n// const artifactsByTaskId = artifacts.groupByTaskId();\n// const files = Object.entries(artifactsByTaskId).map(([taskId, artifact]) => {\n// return artifact.paths.map((path) => this.buildKey(component.id, taskId, path));\n// });\n// // files file to upload\n// }\n\n// private buildKey(id: ComponentID, taskId: string, path: string) {\n// return id.fullName;\n// }\n\n// private upload(key: string, body: string) {\n// const s3 = this.getS3Client();\n// s3.upload({\n// Bucket: 'storage',\n// Key: key,\n// Body: body,\n// });\n// }\n\n// private getS3Client() {\n// //TODO: need to pass bithub token\n// const s3 = new S3({\n// accessKeyId: 'bit',\n// secretAccessKey: process.env.BIT_DEV_TOKEN,\n// endpoint: 'http://bit.test:5003',\n// });\n// return s3;\n// }\n// }\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA","ignoreList":[]}
|
package/storage/s3-resolver.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
// import { S3 } from 'aws-sdk';
|
2
|
-
// import { Component, ComponentID } from '@teambit/component';
|
3
|
-
// import { StorageResolver } from './storage-resolver';
|
4
|
-
// import type { ArtifactList } from '../artifact';
|
5
|
-
|
6
|
-
// export class S3Resolver implements StorageResolver {
|
7
|
-
// name = 's3';
|
8
|
-
// // todo artifact map
|
9
|
-
// async store(component: Component, artifacts: ArtifactList) {
|
10
|
-
// // https://staoge.com/{compId}/aspectId/${path}
|
11
|
-
// const artifactsByTaskId = artifacts.groupByTaskId();
|
12
|
-
// const files = Object.entries(artifactsByTaskId).map(([taskId, artifact]) => {
|
13
|
-
// return artifact.paths.map((path) => this.buildKey(component.id, taskId, path));
|
14
|
-
// });
|
15
|
-
// // files file to upload
|
16
|
-
// }
|
17
|
-
|
18
|
-
// private buildKey(id: ComponentID, taskId: string, path: string) {
|
19
|
-
// return id.fullName;
|
20
|
-
// }
|
21
|
-
|
22
|
-
// private upload(key: string, body: string) {
|
23
|
-
// const s3 = this.getS3Client();
|
24
|
-
// s3.upload({
|
25
|
-
// Bucket: 'storage',
|
26
|
-
// Key: key,
|
27
|
-
// Body: body,
|
28
|
-
// });
|
29
|
-
// }
|
30
|
-
|
31
|
-
// private getS3Client() {
|
32
|
-
// //TODO: need to pass bithub token
|
33
|
-
// const s3 = new S3({
|
34
|
-
// accessKeyId: 'bit',
|
35
|
-
// secretAccessKey: process.env.BIT_DEV_TOKEN,
|
36
|
-
// endpoint: 'http://bit.test:5003',
|
37
|
-
// });
|
38
|
-
// return s3;
|
39
|
-
// }
|
40
|
-
// }
|