@teambit/builder 1.0.208 → 1.0.210
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 +10 -10
- package/dist/artifact/artifacts.cmd.js +1 -1
- package/dist/artifact/artifacts.cmd.js.map +1 -1
- package/dist/build-pipe.js +1 -1
- package/dist/build-pipe.js.map +1 -1
- package/dist/build-pipeline-result-list.js +1 -1
- package/dist/build-pipeline-result-list.js.map +1 -1
- package/dist/build.cmd.js +1 -1
- package/dist/build.cmd.js.map +1 -1
- package/dist/builder.graphql.js +1 -1
- package/dist/builder.graphql.js.map +1 -1
- package/dist/builder.main.runtime.js +1 -1
- package/dist/builder.main.runtime.js.map +1 -1
- package/dist/builder.route.js +1 -1
- package/dist/builder.route.js.map +1 -1
- package/dist/builder.service.js +1 -1
- package/dist/builder.service.js.map +1 -1
- package/dist/{preview-1711458141302.js → preview-1711617900376.js} +2 -2
- package/dist/storage/default-resolver.js +1 -1
- package/package.json +13 -13
|
@@ -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.210" 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={1599:(e,n,t)=>{var i={id:"teambit.pipelines/aspect-docs/builder@0.0.167",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},9601:(e,n,t)=>{Object.defineProperty(n,"M",{enumerable:!0,get:function(){return i.default}});var i=a(t(1599));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.pipelines/aspect-docs/builder@0.0.167",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0}},93512:(e,n,t)=>{var i={id:"teambit.pipelines/builder@1.0.208",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(93512),a=(t(41594),t(5016));const r=TeambitMdxUiMdxScopeContext;var o=t(9601),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,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}(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={84641:(e,n,t)=>{var i={id:"teambit.pipelines/aspect-docs/builder@0.0.167",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},26555:(e,n,t)=>{Object.defineProperty(n,"M",{enumerable:!0,get:function(){return i.default}});var i=a(t(84641));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.pipelines/aspect-docs/builder@0.0.167",homepage:"https://bit.cloud/teambit/pipelines/aspect-docs/builder",exported:!0}},72905:(e,n,t)=>{var i={id:"teambit.pipelines/builder@1.0.210",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(72905),a=(t(41594),t(5016));const r=TeambitMdxUiMdxScopeContext;var o=t(26555),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,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}(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})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
"_legacy": {
|
|
1065
1065
|
"scope": "teambit.pipelines",
|
|
1066
1066
|
"name": "builder",
|
|
1067
|
-
"version": "1.0.
|
|
1067
|
+
"version": "1.0.210"
|
|
1068
1068
|
},
|
|
1069
1069
|
"_scope": "teambit.pipelines"
|
|
1070
1070
|
}
|
|
@@ -1548,7 +1548,7 @@
|
|
|
1548
1548
|
"line": 11,
|
|
1549
1549
|
"character": 1
|
|
1550
1550
|
},
|
|
1551
|
-
"signature": "type TaskLocation = \"
|
|
1551
|
+
"signature": "type TaskLocation = \"end\" | \"start\"",
|
|
1552
1552
|
"name": "TaskLocation",
|
|
1553
1553
|
"type": {
|
|
1554
1554
|
"__schema": "TypeUnionSchema",
|
|
@@ -1607,7 +1607,7 @@
|
|
|
1607
1607
|
"line": 51,
|
|
1608
1608
|
"character": 1
|
|
1609
1609
|
},
|
|
1610
|
-
"signature": "type PipeName = \"
|
|
1610
|
+
"signature": "type PipeName = \"tag\" | \"build\" | \"snap\"",
|
|
1611
1611
|
"name": "PipeName",
|
|
1612
1612
|
"type": {
|
|
1613
1613
|
"__schema": "TypeUnionSchema",
|
|
@@ -5841,7 +5841,7 @@
|
|
|
5841
5841
|
"line": 30,
|
|
5842
5842
|
"character": 1
|
|
5843
5843
|
},
|
|
5844
|
-
"signature": "type ArtifactStorageResolver =
|
|
5844
|
+
"signature": "type ArtifactStorageResolver = WholeArtifactStorageResolver | FileStorageResolver",
|
|
5845
5845
|
"name": "ArtifactStorageResolver",
|
|
5846
5846
|
"type": {
|
|
5847
5847
|
"__schema": "TypeUnionSchema",
|
|
@@ -7396,7 +7396,7 @@
|
|
|
7396
7396
|
"_legacy": {
|
|
7397
7397
|
"scope": "teambit.pipelines",
|
|
7398
7398
|
"name": "builder",
|
|
7399
|
-
"version": "1.0.
|
|
7399
|
+
"version": "1.0.210"
|
|
7400
7400
|
},
|
|
7401
7401
|
"_scope": "teambit.pipelines"
|
|
7402
7402
|
}
|
|
@@ -9306,7 +9306,7 @@
|
|
|
9306
9306
|
"line": 11,
|
|
9307
9307
|
"character": 1
|
|
9308
9308
|
},
|
|
9309
|
-
"signature": "type TaskLocation = \"
|
|
9309
|
+
"signature": "type TaskLocation = \"end\" | \"start\"",
|
|
9310
9310
|
"name": "TaskLocation",
|
|
9311
9311
|
"type": {
|
|
9312
9312
|
"__schema": "TypeUnionSchema",
|
|
@@ -9621,7 +9621,7 @@
|
|
|
9621
9621
|
"_legacy": {
|
|
9622
9622
|
"scope": "teambit.pipelines",
|
|
9623
9623
|
"name": "builder",
|
|
9624
|
-
"version": "1.0.
|
|
9624
|
+
"version": "1.0.210"
|
|
9625
9625
|
},
|
|
9626
9626
|
"_scope": "teambit.pipelines"
|
|
9627
9627
|
}
|
|
@@ -14630,7 +14630,7 @@
|
|
|
14630
14630
|
"line": 30,
|
|
14631
14631
|
"character": 1
|
|
14632
14632
|
},
|
|
14633
|
-
"signature": "type ArtifactStorageResolver =
|
|
14633
|
+
"signature": "type ArtifactStorageResolver = WholeArtifactStorageResolver | FileStorageResolver",
|
|
14634
14634
|
"name": "ArtifactStorageResolver",
|
|
14635
14635
|
"type": {
|
|
14636
14636
|
"__schema": "TypeUnionSchema",
|
|
@@ -16356,7 +16356,7 @@
|
|
|
16356
16356
|
"_legacy": {
|
|
16357
16357
|
"scope": "teambit.pipelines",
|
|
16358
16358
|
"name": "builder",
|
|
16359
|
-
"version": "1.0.
|
|
16359
|
+
"version": "1.0.210"
|
|
16360
16360
|
},
|
|
16361
16361
|
"_scope": "teambit.pipelines"
|
|
16362
16362
|
}
|
|
@@ -16619,7 +16619,7 @@
|
|
|
16619
16619
|
"componentId": {
|
|
16620
16620
|
"scope": "teambit.pipelines",
|
|
16621
16621
|
"name": "builder",
|
|
16622
|
-
"version": "1.0.
|
|
16622
|
+
"version": "1.0.210"
|
|
16623
16623
|
},
|
|
16624
16624
|
"taggedModuleExports": []
|
|
16625
16625
|
}
|
|
@@ -27,7 +27,7 @@ function _artifactExtractor() {
|
|
|
27
27
|
}
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
30
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
31
31
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
32
|
const INDENT_TITLE = ' '.repeat(2);
|
|
33
33
|
const INDENT_SUB_TITLE = ' '.repeat(4);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","_artifactExtractor","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_constants","_artifactExtractor","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","INDENT_TITLE","repeat","INDENT_SUB_TITLE","INDENT_FILES","ArtifactsCmd","constructor","builder","componentMain","name","description","COMPONENT_PATTERN_HELP","report","componentPattern","artifactsOpts","artifactExtractor","ArtifactExtractor","list","grouped","groupResultsByAspect","outputArtifacts","aspectId","artifactData","title","chalk","green","artifactDataStr","map","artifact","subTitle","white","taskName","artifactName","files","f","dim","join","outputResult","result","idStr","cyan","id","toString","artifacts","keys","footer","outDir","exports"],"sources":["artifacts.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport { ComponentMain } from '@teambit/component';\nimport { BuilderMain } from '../builder.main.runtime';\nimport { ArtifactExtractor, ExtractorArtifactResult, ExtractorResultGrouped } from './artifact-extractor';\n\nconst INDENT_TITLE = ' '.repeat(2);\nconst INDENT_SUB_TITLE = ' '.repeat(4);\nconst INDENT_FILES = ' '.repeat(6);\n\nexport type ArtifactsOpts = {\n aspect?: string;\n task?: string;\n files?: string;\n outDir?: string;\n};\n\nexport class ArtifactsCmd implements Command {\n name = 'artifacts <component-pattern>';\n description = 'list and download component artifacts';\n extendedDescription = `artifacts are created on isolated capsules during tag or snap commands.\nexample of artifacts are dists files generated by a compiler, a JUnit.xml file generated by a tester\nand a package.tgz file generated by pkg aspect.\n`;\n arguments = [\n {\n name: 'component-pattern',\n description: COMPONENT_PATTERN_HELP,\n },\n ];\n alias = '';\n group = 'development';\n helpUrl = 'reference/components/component-artifacts';\n options = [\n ['', 'aspect <aspect-id>', 'show/download only artifacts generated by this aspect-id'],\n ['', 'task <task-id>', 'show/download only artifacts generated by this task-id'],\n [\n '',\n 'files <glob>',\n 'show/download only artifacts matching the given files or the glob pattern (wrap glob patterns in quotes)',\n ],\n ['', 'out-dir <string>', 'download the files to the specified dir'],\n ] as CommandOptions;\n\n constructor(private builder: BuilderMain, private componentMain: ComponentMain) {}\n\n async report([componentPattern]: [string], artifactsOpts: ArtifactsOpts): Promise<string> {\n const artifactExtractor = new ArtifactExtractor(this.componentMain, this.builder, componentPattern, artifactsOpts);\n const list = await artifactExtractor.list();\n const grouped = artifactExtractor.groupResultsByAspect(list);\n const outputArtifacts = (aspectId: string, artifactData: ExtractorArtifactResult[]) => {\n const title = chalk.green(aspectId);\n const artifactDataStr = artifactData\n .map((artifact) => {\n const subTitle = chalk.white(`${artifact.taskName} (${artifact.artifactName})`);\n const files = artifact.files.map((f) => INDENT_FILES + chalk.dim(f)).join('\\n');\n return `${INDENT_SUB_TITLE}${subTitle}\\n${files}`;\n })\n .join('\\n');\n return `${INDENT_TITLE}${title}\\n${artifactDataStr}`;\n };\n const outputResult = (result: ExtractorResultGrouped) => {\n const idStr = chalk.cyan(result.id.toString());\n const artifacts = Object.keys(result.artifacts)\n .map((aspectId) => outputArtifacts(aspectId, result.artifacts[aspectId]))\n .join('\\n\\n');\n return `${idStr}\\n${artifacts}`;\n };\n const footer = artifactsOpts.outDir\n ? chalk.green('\\n\\nThe above files were saved successfully to the file system')\n : '';\n return grouped.map(outputResult).join('\\n\\n') + footer;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0G,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA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,CAAC,MAAM,CAAC;MACf,OAAQ,GAAEG,KAAM,KAAII,SAAU,EAAC;IACjC,CAAC;IACD,MAAME,MAAM,GAAG/B,aAAa,CAACgC,MAAM,GAC/BtB,gBAAK,CAACC,KAAK,CAAC,gEAAgE,CAAC,GAC7E,EAAE;IACN,OAAOP,OAAO,CAACS,GAAG,CAACU,YAAY,CAAC,CAACD,IAAI,CAAC,MAAM,CAAC,GAAGS,MAAM;EACxD;AACF;AAACE,OAAA,CAAA1C,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/dist/build-pipe.js
CHANGED
|
@@ -55,7 +55,7 @@ function _taskResultsList() {
|
|
|
55
55
|
}
|
|
56
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
57
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
58
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
58
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
59
59
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
60
60
|
class BuildPipe {
|
|
61
61
|
constructor(
|
package/dist/build-pipe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_component","data","require","_pMapSeries","_interopRequireDefault","_prettyTime","_toolboxString","_chalk","_buildTask","_taskResultsList","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","BuildPipe","constructor","tasksQueue","envsBuildContext","logger","artifactFactory","previousTaskResults","options","allTasksResults","taskResults","execute","addSignalListener","executePreBuild","longProcessLogger","createLongProcessLogger","length","mapSeries","task","env","executeTask","end","capsuleRootDir","values","capsuleNetwork","capsulesRootDir","tasksResultsList","TaskResultsList","executePostBuild","process","on","exit","setStatusLine","preBuild","getBuildContext","id","taskId","BuildTaskHelper","serializeId","envName","showEnvNameInOutput","getPrettyEnvName","buildContext","hasOriginalSeeders","Boolean","_originalSeeders","dependencyStr","taskLogPrefix","getPrettyAspectName","aspectId","name","logProgress","description","updateFailedDependencyTask","shouldSkipTask","startTask","hrtime","taskStartTime","Date","now","buildTaskResult","err","consoleFailure","endTime","compsWithErrors","componentsResults","filter","c","errors","artifacts","duration","prettyTime","chalk","red","getProgress","failedTasks","push","color","green","dim","consoleSuccess","defs","generate","startTime","resolvedId","ComponentID","fromString","tokens","split","map","token","capitalize","join","envId","ver","showEnvVersionInOutput","version","fullName","tasksResults","postBuild","failedDependencyTask","dependencies","forEach","dependency","deserializeIdAllowEmptyName","find","failedTask","exitOnFirstFailedTask","failedTaskId","consoleWarning","Error","previousTasksResults","exports"],"sources":["build-pipe.ts"],"sourcesContent":["import { EnvDefinition } from '@teambit/envs';\nimport { ComponentMap, ComponentID } from '@teambit/component';\nimport { Logger, LongProcessLogger } from '@teambit/logger';\nimport mapSeries from 'p-map-series';\nimport prettyTime from 'pretty-time';\nimport { capitalize } from '@teambit/toolbox.string.capitalize';\nimport chalk from 'chalk';\nimport { ArtifactFactory, ArtifactList, FsArtifact } from './artifact';\nimport { BuildContext, BuildTask, BuildTaskHelper, BuiltTaskResult } from './build-task';\nimport { ComponentResult } from './types';\nimport { TasksQueue } from './tasks-queue';\nimport { EnvsBuildContext } from './builder.service';\nimport { TaskResultsList } from './task-results-list';\n\nexport type TaskResults = {\n /**\n * task itself. useful for getting its id/description later on.\n */\n task: BuildTask;\n\n /**\n * environment were the task was running\n */\n env: EnvDefinition;\n\n /**\n * component build results.\n */\n componentsResults: ComponentResult[];\n\n /**\n * artifacts generated by the build pipeline.\n * in case the task finished with errors, this prop is undefined.\n */\n artifacts: ComponentMap<ArtifactList<FsArtifact>> | undefined;\n\n /**\n * timestamp of start initiation.\n */\n startTime: number;\n\n /**\n * timestamp of task completion.\n */\n endTime: number;\n};\n\ntype PipeOptions = {\n exitOnFirstFailedTask?: boolean; // by default it skips only when a dependent failed.\n showEnvNameInOutput?: boolean;\n showEnvVersionInOutput?: boolean; // in case it shows the env-name, whether should show also the version\n};\n\nexport class BuildPipe {\n private failedTasks: BuildTask[] = [];\n private failedDependencyTask: BuildTask | undefined;\n private longProcessLogger: LongProcessLogger;\n private taskResults: TaskResults[] = [];\n constructor(\n /**\n * array of services to apply on the components.\n */\n readonly tasksQueue: TasksQueue,\n readonly envsBuildContext: EnvsBuildContext,\n readonly logger: Logger,\n readonly artifactFactory: ArtifactFactory,\n private previousTaskResults?: TaskResults[],\n private options?: PipeOptions\n ) {}\n\n get allTasksResults(): TaskResults[] {\n return [...(this.previousTaskResults || []), ...(this.taskResults || [])];\n }\n\n /**\n * execute a pipeline of build tasks.\n */\n async execute(): Promise<TaskResultsList> {\n this.addSignalListener();\n await this.executePreBuild();\n this.longProcessLogger = this.logger.createLongProcessLogger('running tasks', this.tasksQueue.length);\n await mapSeries(this.tasksQueue, async ({ task, env }) => this.executeTask(task, env));\n this.longProcessLogger.end();\n const capsuleRootDir = Object.values(this.envsBuildContext)[0]?.capsuleNetwork.capsulesRootDir;\n const tasksResultsList = new TaskResultsList(this.tasksQueue, this.taskResults, capsuleRootDir);\n await this.executePostBuild(tasksResultsList);\n\n return tasksResultsList;\n }\n\n /**\n * for some reason, some tasks (such as typescript compilation) ignore ctrl+C. this fixes it.\n */\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n\n private async executePreBuild() {\n this.logger.setStatusLine('executing pre-build for all tasks');\n const longProcessLogger = this.logger.createLongProcessLogger('running pre-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.preBuild) return;\n await task.preBuild(this.getBuildContext(env.id));\n });\n longProcessLogger.end();\n }\n\n private async executeTask(task: BuildTask, env: EnvDefinition): Promise<void> {\n const taskId = BuildTaskHelper.serializeId(task);\n const envName = this.options?.showEnvNameInOutput ? `(${this.getPrettyEnvName(env.id)}) ` : '';\n const buildContext = this.getBuildContext(env.id);\n const hasOriginalSeeders = Boolean(buildContext.capsuleNetwork._originalSeeders?.length);\n const dependencyStr = hasOriginalSeeders ? '' : `[dependency] `;\n const taskLogPrefix = `${dependencyStr}${envName}[${this.getPrettyAspectName(task.aspectId)}: ${task.name}]`;\n this.longProcessLogger.logProgress(`${taskLogPrefix}${task.description ? ` ${task.description}` : ''}`, false);\n this.updateFailedDependencyTask(task);\n if (this.shouldSkipTask(taskId, env.id)) {\n return;\n }\n const startTask = process.hrtime();\n const taskStartTime = Date.now();\n let buildTaskResult: BuiltTaskResult;\n try {\n buildTaskResult = await task.execute(buildContext);\n } catch (err) {\n this.logger.consoleFailure(`env: ${env.id}, task \"${taskId}\" threw an error`);\n throw err;\n }\n\n const endTime = Date.now();\n const compsWithErrors = buildTaskResult.componentsResults.filter((c) => c.errors?.length);\n let artifacts: ComponentMap<ArtifactList<FsArtifact>> | undefined;\n const duration = prettyTime(process.hrtime(startTask));\n if (compsWithErrors.length) {\n this.logger.consoleFailure(`env: ${env.id}, task \"${taskId}\" has failed`);\n this.logger.consoleFailure(\n chalk.red(`${this.longProcessLogger.getProgress()} env: ${env.id}, task \"${taskId}\" has failed in ${duration}`)\n );\n this.failedTasks.push(task);\n } else {\n const color = hasOriginalSeeders ? chalk.green : chalk.green.dim;\n this.logger.consoleSuccess(\n color(`${this.longProcessLogger.getProgress()} ${taskLogPrefix} Completed successfully in ${duration}`)\n );\n const defs = buildTaskResult.artifacts || [];\n artifacts = this.artifactFactory.generate(buildContext, defs, task);\n }\n\n const taskResults: TaskResults = {\n task,\n env,\n componentsResults: buildTaskResult.componentsResults,\n artifacts,\n startTime: taskStartTime,\n endTime,\n };\n\n this.taskResults.push(taskResults);\n }\n\n private getPrettyAspectName(aspectId: string): string {\n const resolvedId = ComponentID.fromString(aspectId);\n const tokens = resolvedId.name.split('-').map((token) => capitalize(token));\n return tokens.join(' ');\n }\n\n private getPrettyEnvName(envId: string) {\n const resolvedId = ComponentID.fromString(envId);\n const ver = this.options?.showEnvVersionInOutput ? `@${resolvedId.version}` : '';\n return `${resolvedId.fullName}${ver}`;\n }\n\n private async executePostBuild(tasksResults: TaskResultsList) {\n const longProcessLogger = this.logger.createLongProcessLogger('running post-build for all tasks');\n this.logger.setStatusLine('executing post-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.postBuild) return;\n await task.postBuild(this.getBuildContext(env.id), tasksResults);\n });\n longProcessLogger.end();\n }\n\n private updateFailedDependencyTask(task: BuildTask) {\n if (!this.failedDependencyTask && this.failedTasks.length && task.dependencies) {\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeIdAllowEmptyName(dependency);\n this.failedDependencyTask = this.failedTasks.find((failedTask) => {\n if (name && name !== failedTask.name) return false;\n return aspectId === failedTask.aspectId;\n });\n });\n }\n }\n\n private shouldSkipTask(taskId: string, envId: string): boolean {\n if (this.options?.exitOnFirstFailedTask && this.failedTasks.length) {\n const failedTaskId = BuildTaskHelper.serializeId(this.failedTasks[0]);\n this.logger.consoleWarning(`env: ${envId}, task \"${taskId}\" has skipped due to \"${failedTaskId}\" failure`);\n return true;\n }\n if (!this.failedDependencyTask) return false;\n const failedTaskId = BuildTaskHelper.serializeId(this.failedDependencyTask);\n this.logger.consoleWarning(`env: ${envId}, task \"${taskId}\" has skipped due to \"${failedTaskId}\" failure`);\n return true;\n }\n\n private getBuildContext(envId: string): BuildContext {\n const buildContext = this.envsBuildContext[envId];\n if (!buildContext) throw new Error(`unable to find buildContext for ${envId}`);\n buildContext.previousTasksResults = this.allTasksResults;\n return buildCont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Aa,WAAU,CAAC;MAC1G,OAAO,IAAI;IACb;IACA,IAAI,CAAC,IAAI,CAACR,oBAAoB,EAAE,OAAO,KAAK;IAC5C,MAAMQ,YAAY,GAAGvE,4BAAe,CAACC,WAAW,CAAC,IAAI,CAAC8D,oBAAoB,CAAC;IAC3E,IAAI,CAAC/F,MAAM,CAACwG,cAAc,CAAE,QAAOhB,KAAM,WAAUzD,MAAO,yBAAwBwE,YAAa,WAAU,CAAC;IAC1G,OAAO,IAAI;EACb;EAEQ1E,eAAeA,CAAC2D,KAAa,EAAgB;IACnD,MAAMnD,YAAY,GAAG,IAAI,CAACtC,gBAAgB,CAACyF,KAAK,CAAC;IACjD,IAAI,CAACnD,YAAY,EAAE,MAAM,IAAIoE,KAAK,CAAE,mCAAkCjB,KAAM,EAAC,CAAC;IAC9EnD,YAAY,CAACqE,oBAAoB,GAAG,IAAI,CAACtG,eAAe;IACxD,OAAOiC,YAAY;EACrB;AACF;AAACsE,OAAA,CAAA/G,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_component","data","require","_pMapSeries","_interopRequireDefault","_prettyTime","_toolboxString","_chalk","_buildTask","_taskResultsList","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","BuildPipe","constructor","tasksQueue","envsBuildContext","logger","artifactFactory","previousTaskResults","options","allTasksResults","taskResults","execute","addSignalListener","executePreBuild","longProcessLogger","createLongProcessLogger","length","mapSeries","task","env","executeTask","end","capsuleRootDir","values","capsuleNetwork","capsulesRootDir","tasksResultsList","TaskResultsList","executePostBuild","process","on","exit","setStatusLine","preBuild","getBuildContext","id","taskId","BuildTaskHelper","serializeId","envName","showEnvNameInOutput","getPrettyEnvName","buildContext","hasOriginalSeeders","Boolean","_originalSeeders","dependencyStr","taskLogPrefix","getPrettyAspectName","aspectId","name","logProgress","description","updateFailedDependencyTask","shouldSkipTask","startTask","hrtime","taskStartTime","Date","now","buildTaskResult","err","consoleFailure","endTime","compsWithErrors","componentsResults","filter","c","errors","artifacts","duration","prettyTime","chalk","red","getProgress","failedTasks","push","color","green","dim","consoleSuccess","defs","generate","startTime","resolvedId","ComponentID","fromString","tokens","split","map","token","capitalize","join","envId","ver","showEnvVersionInOutput","version","fullName","tasksResults","postBuild","failedDependencyTask","dependencies","forEach","dependency","deserializeIdAllowEmptyName","find","failedTask","exitOnFirstFailedTask","failedTaskId","consoleWarning","Error","previousTasksResults","exports"],"sources":["build-pipe.ts"],"sourcesContent":["import { EnvDefinition } from '@teambit/envs';\nimport { ComponentMap, ComponentID } from '@teambit/component';\nimport { Logger, LongProcessLogger } from '@teambit/logger';\nimport mapSeries from 'p-map-series';\nimport prettyTime from 'pretty-time';\nimport { capitalize } from '@teambit/toolbox.string.capitalize';\nimport chalk from 'chalk';\nimport { ArtifactFactory, ArtifactList, FsArtifact } from './artifact';\nimport { BuildContext, BuildTask, BuildTaskHelper, BuiltTaskResult } from './build-task';\nimport { ComponentResult } from './types';\nimport { TasksQueue } from './tasks-queue';\nimport { EnvsBuildContext } from './builder.service';\nimport { TaskResultsList } from './task-results-list';\n\nexport type TaskResults = {\n /**\n * task itself. useful for getting its id/description later on.\n */\n task: BuildTask;\n\n /**\n * environment were the task was running\n */\n env: EnvDefinition;\n\n /**\n * component build results.\n */\n componentsResults: ComponentResult[];\n\n /**\n * artifacts generated by the build pipeline.\n * in case the task finished with errors, this prop is undefined.\n */\n artifacts: ComponentMap<ArtifactList<FsArtifact>> | undefined;\n\n /**\n * timestamp of start initiation.\n */\n startTime: number;\n\n /**\n * timestamp of task completion.\n */\n endTime: number;\n};\n\ntype PipeOptions = {\n exitOnFirstFailedTask?: boolean; // by default it skips only when a dependent failed.\n showEnvNameInOutput?: boolean;\n showEnvVersionInOutput?: boolean; // in case it shows the env-name, whether should show also the version\n};\n\nexport class BuildPipe {\n private failedTasks: BuildTask[] = [];\n private failedDependencyTask: BuildTask | undefined;\n private longProcessLogger: LongProcessLogger;\n private taskResults: TaskResults[] = [];\n constructor(\n /**\n * array of services to apply on the components.\n */\n readonly tasksQueue: TasksQueue,\n readonly envsBuildContext: EnvsBuildContext,\n readonly logger: Logger,\n readonly artifactFactory: ArtifactFactory,\n private previousTaskResults?: TaskResults[],\n private options?: PipeOptions\n ) {}\n\n get allTasksResults(): TaskResults[] {\n return [...(this.previousTaskResults || []), ...(this.taskResults || [])];\n }\n\n /**\n * execute a pipeline of build tasks.\n */\n async execute(): Promise<TaskResultsList> {\n this.addSignalListener();\n await this.executePreBuild();\n this.longProcessLogger = this.logger.createLongProcessLogger('running tasks', this.tasksQueue.length);\n await mapSeries(this.tasksQueue, async ({ task, env }) => this.executeTask(task, env));\n this.longProcessLogger.end();\n const capsuleRootDir = Object.values(this.envsBuildContext)[0]?.capsuleNetwork.capsulesRootDir;\n const tasksResultsList = new TaskResultsList(this.tasksQueue, this.taskResults, capsuleRootDir);\n await this.executePostBuild(tasksResultsList);\n\n return tasksResultsList;\n }\n\n /**\n * for some reason, some tasks (such as typescript compilation) ignore ctrl+C. this fixes it.\n */\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n\n private async executePreBuild() {\n this.logger.setStatusLine('executing pre-build for all tasks');\n const longProcessLogger = this.logger.createLongProcessLogger('running pre-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.preBuild) return;\n await task.preBuild(this.getBuildContext(env.id));\n });\n longProcessLogger.end();\n }\n\n private async executeTask(task: BuildTask, env: EnvDefinition): Promise<void> {\n const taskId = BuildTaskHelper.serializeId(task);\n const envName = this.options?.showEnvNameInOutput ? `(${this.getPrettyEnvName(env.id)}) ` : '';\n const buildContext = this.getBuildContext(env.id);\n const hasOriginalSeeders = Boolean(buildContext.capsuleNetwork._originalSeeders?.length);\n const dependencyStr = hasOriginalSeeders ? '' : `[dependency] `;\n const taskLogPrefix = `${dependencyStr}${envName}[${this.getPrettyAspectName(task.aspectId)}: ${task.name}]`;\n this.longProcessLogger.logProgress(`${taskLogPrefix}${task.description ? ` ${task.description}` : ''}`, false);\n this.updateFailedDependencyTask(task);\n if (this.shouldSkipTask(taskId, env.id)) {\n return;\n }\n const startTask = process.hrtime();\n const taskStartTime = Date.now();\n let buildTaskResult: BuiltTaskResult;\n try {\n buildTaskResult = await task.execute(buildContext);\n } catch (err) {\n this.logger.consoleFailure(`env: ${env.id}, task \"${taskId}\" threw an error`);\n throw err;\n }\n\n const endTime = Date.now();\n const compsWithErrors = buildTaskResult.componentsResults.filter((c) => c.errors?.length);\n let artifacts: ComponentMap<ArtifactList<FsArtifact>> | undefined;\n const duration = prettyTime(process.hrtime(startTask));\n if (compsWithErrors.length) {\n this.logger.consoleFailure(`env: ${env.id}, task \"${taskId}\" has failed`);\n this.logger.consoleFailure(\n chalk.red(`${this.longProcessLogger.getProgress()} env: ${env.id}, task \"${taskId}\" has failed in ${duration}`)\n );\n this.failedTasks.push(task);\n } else {\n const color = hasOriginalSeeders ? chalk.green : chalk.green.dim;\n this.logger.consoleSuccess(\n color(`${this.longProcessLogger.getProgress()} ${taskLogPrefix} Completed successfully in ${duration}`)\n );\n const defs = buildTaskResult.artifacts || [];\n artifacts = this.artifactFactory.generate(buildContext, defs, task);\n }\n\n const taskResults: TaskResults = {\n task,\n env,\n componentsResults: buildTaskResult.componentsResults,\n artifacts,\n startTime: taskStartTime,\n endTime,\n };\n\n this.taskResults.push(taskResults);\n }\n\n private getPrettyAspectName(aspectId: string): string {\n const resolvedId = ComponentID.fromString(aspectId);\n const tokens = resolvedId.name.split('-').map((token) => capitalize(token));\n return tokens.join(' ');\n }\n\n private getPrettyEnvName(envId: string) {\n const resolvedId = ComponentID.fromString(envId);\n const ver = this.options?.showEnvVersionInOutput ? `@${resolvedId.version}` : '';\n return `${resolvedId.fullName}${ver}`;\n }\n\n private async executePostBuild(tasksResults: TaskResultsList) {\n const longProcessLogger = this.logger.createLongProcessLogger('running post-build for all tasks');\n this.logger.setStatusLine('executing post-build for all tasks');\n await mapSeries(this.tasksQueue, async ({ task, env }) => {\n if (!task.postBuild) return;\n await task.postBuild(this.getBuildContext(env.id), tasksResults);\n });\n longProcessLogger.end();\n }\n\n private updateFailedDependencyTask(task: BuildTask) {\n if (!this.failedDependencyTask && this.failedTasks.length && task.dependencies) {\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeIdAllowEmptyName(dependency);\n this.failedDependencyTask = this.failedTasks.find((failedTask) => {\n if (name && name !== failedTask.name) return false;\n return aspectId === failedTask.aspectId;\n });\n });\n }\n }\n\n private shouldSkipTask(taskId: string, envId: string): boolean {\n if (this.options?.exitOnFirstFailedTask && this.failedTasks.length) {\n const failedTaskId = BuildTaskHelper.serializeId(this.failedTasks[0]);\n this.logger.consoleWarning(`env: ${envId}, task \"${taskId}\" has skipped due to \"${failedTaskId}\" failure`);\n return true;\n }\n if (!this.failedDependencyTask) return false;\n const failedTaskId = BuildTaskHelper.serializeId(this.failedDependencyTask);\n this.logger.consoleWarning(`env: ${envId}, task \"${taskId}\" has skipped due to \"${failedTaskId}\" failure`);\n return true;\n }\n\n private getBuildContext(envId: string): BuildContext {\n const buildContext = this.envsBuildContext[envId];\n if (!buildContext) throw new Error(`unable to find buildContext for ${envId}`);\n buildContext.previousTasksResults = this.allTasksResults;\n return buildContext;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,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AAI,CAACtC,gBAAgB,CAACyF,KAAK,CAAC;IACjD,IAAI,CAACnD,YAAY,EAAE,MAAM,IAAIoE,KAAK,CAAE,mCAAkCjB,KAAM,EAAC,CAAC;IAC9EnD,YAAY,CAACqE,oBAAoB,GAAG,IAAI,CAACtG,eAAe;IACxD,OAAOiC,YAAY;EACrB;AACF;AAACsE,OAAA,CAAA/G,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -28,7 +28,7 @@ function _artifact() {
|
|
|
28
28
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
29
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
30
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
31
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
32
32
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
33
33
|
/**
|
|
34
34
|
* Helper to get the data and artifacts from the TasksResultsList before saving during the tag
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_component","data","require","_lodash","_artifact","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","
|
|
1
|
+
{"version":3,"names":["_component","data","require","_lodash","_artifact","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BuildPipelineResultList","constructor","tasksResults","components","artifactListsMap","getFlattenedArtifactListsMapFromAllTasks","artifactListsMaps","flatMap","artifacts","ComponentMap","as","component","artifactListMap","artifactList","getValueByComponentId","id","ArtifactList","fromArray","getMetadataFromTaskResults","componentId","compResults","reduce","acc","current","foundComponent","componentsResults","find","c","isEqual","taskId","task","aspectId","metadata","mergeDataIfPossible","getPipelineReportOfComponent","map","taskResults","pipelineReport","taskName","name","taskDescription","description","errors","warnings","startTime","endTime","compact","getDataOfComponent","tasksData","getArtifactsDataOfComponent","toObject","currentData","existingData","isEmpty","Error","Array","isArray","exports"],"sources":["build-pipeline-result-list.ts"],"sourcesContent":["import { ComponentID, ComponentMap, Component } from '@teambit/component';\nimport { isEmpty, compact } from 'lodash';\nimport type { ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { Artifact, ArtifactList } from './artifact';\nimport { TaskResults } from './build-pipe';\nimport { TaskMetadata } from './types';\n\nexport type PipelineReport = {\n taskId: string; // task aspect-id\n taskName: string;\n taskDescription?: string;\n startTime?: number;\n endTime?: number;\n errors?: Array<Error | string>;\n warnings?: string[];\n};\n\nexport type AspectData = {\n aspectId: string;\n data: TaskMetadata;\n};\n\n/**\n * Helper to get the data and artifacts from the TasksResultsList before saving during the tag\n */\nexport class BuildPipelineResultList {\n private artifactListsMap: ComponentMap<ArtifactList<Artifact>>;\n constructor(private tasksResults: TaskResults[], private components: Component[]) {\n this.artifactListsMap = this.getFlattenedArtifactListsMapFromAllTasks();\n }\n\n private getFlattenedArtifactListsMapFromAllTasks(): ComponentMap<ArtifactList<Artifact>> {\n const artifactListsMaps = this.tasksResults.flatMap((t) => (t.artifacts ? [t.artifacts] : []));\n return ComponentMap.as<ArtifactList<Artifact>>(this.components, (component) => {\n const artifacts: Artifact[] = [];\n artifactListsMaps.forEach((artifactListMap) => {\n const artifactList = artifactListMap.getValueByComponentId(component.id);\n if (artifactList) artifacts.push(...artifactList);\n });\n return ArtifactList.fromArray(artifacts);\n });\n }\n\n public getMetadataFromTaskResults(componentId: ComponentID): { [taskId: string]: TaskMetadata } {\n const compResults = this.tasksResults.reduce((acc, current: TaskResults) => {\n const foundComponent = current.componentsResults.find((c) => c.component.id.isEqual(componentId));\n const taskId = current.task.aspectId;\n if (foundComponent && foundComponent.metadata) {\n acc[taskId] = this.mergeDataIfPossible(foundComponent.metadata, acc[taskId], taskId);\n }\n return acc;\n }, {});\n return compResults;\n }\n\n public getPipelineReportOfComponent(componentId: ComponentID): PipelineReport[] {\n const compResults = this.tasksResults.map((taskResults: TaskResults) => {\n const foundComponent = taskResults.componentsResults.find((c) => c.component.id.isEqual(componentId));\n if (!foundComponent) return null;\n const pipelineReport: PipelineReport = {\n taskId: taskResults.task.aspectId,\n taskName: taskResults.task.name,\n taskDescription: taskResults.task.description,\n errors: foundComponent.errors,\n warnings: foundComponent.warnings,\n startTime: foundComponent.startTime,\n endTime: foundComponent.endTime,\n };\n return pipelineReport;\n });\n return compact(compResults);\n }\n\n public getDataOfComponent(componentId: ComponentID): AspectData[] {\n const tasksData = this.getMetadataFromTaskResults(componentId);\n return Object.keys(tasksData).map((taskId) => ({\n aspectId: taskId,\n data: tasksData[taskId],\n }));\n }\n\n public getArtifactsDataOfComponent(componentId: ComponentID): ArtifactObject[] | undefined {\n return this.artifactListsMap.getValueByComponentId(componentId)?.toObject();\n }\n\n private mergeDataIfPossible(currentData: TaskMetadata, existingData: TaskMetadata | undefined, taskId: string) {\n if (!existingData || isEmpty(existingData)) return currentData;\n // both exist\n if (typeof currentData !== 'object') {\n throw new Error(`task data must be \"object\", get ${typeof currentData} for ${taskId}`);\n }\n if (Array.isArray(currentData)) {\n throw new Error(`task data must be \"object\", get Array for ${taskId}`);\n }\n return { ...currentData, ...existingData };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EA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BpE,IAAI,EAAEuF,SAAS,CAACnB,MAAM;IACxB,CAAC,CAAC,CAAC;EACL;EAEOoB,2BAA2BA,CAAC9B,WAAwB,EAAgC;IACzF,OAAO,IAAI,CAACf,gBAAgB,CAACU,qBAAqB,CAACK,WAAW,CAAC,EAAE+B,QAAQ,CAAC,CAAC;EAC7E;EAEQjB,mBAAmBA,CAACkB,WAAyB,EAAEC,YAAsC,EAAEvB,MAAc,EAAE;IAC7G,IAAI,CAACuB,YAAY,IAAI,IAAAC,iBAAO,EAACD,YAAY,CAAC,EAAE,OAAOD,WAAW;IAC9D;IACA,IAAI,OAAOA,WAAW,KAAK,QAAQ,EAAE;MACnC,MAAM,IAAIG,KAAK,CAAE,mCAAkC,OAAOH,WAAY,QAAOtB,MAAO,EAAC,CAAC;IACxF;IACA,IAAI0B,KAAK,CAACC,OAAO,CAACL,WAAW,CAAC,EAAE;MAC9B,MAAM,IAAIG,KAAK,CAAE,6CAA4CzB,MAAO,EAAC,CAAC;IACxE;IACA,OAAAnD,aAAA,CAAAA,aAAA,KAAYyE,WAAW,GAAKC,YAAY;EAC1C;AACF;AAACK,OAAA,CAAAzD,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
package/dist/build.cmd.js
CHANGED
|
@@ -34,7 +34,7 @@ function _chalk() {
|
|
|
34
34
|
}
|
|
35
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
36
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
37
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
38
38
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
39
39
|
class BuilderCmd {
|
|
40
40
|
constructor(builder, workspace, logger) {
|
package/dist/build.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_prettyTime","data","_interopRequireDefault","require","_workspace","_constants","_chalk","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","BuilderCmd","constructor","builder","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","dev","install","cachePackagesOnCapsulesRoot","reuseCapsules","tasks","listTasks","skipTests","failFast","includeSnap","includeTag","OutsideWorkspaceError","consoleWarning","getListTasks","setStatusLine","start","process","hrtime","components","getComponentsByUserInput","length","chalk","bold","envsExecutionResults","build","installOptions","installTeambitBit","packageManagerConfigRootDir","path","linkingOptions","linkTeambitBit","emptyRootDir","getExistingAsIs","split","map","task","trim","exitOnFirstFailedTask","console","capsuleRootDir","duration","prettyTime","succeedOrFailed","hasErrors","msg","consoleFailure","throwErrorsIfExist","green","componentIdStr","compId","resolveComponentId","component","get","results","id","toString","envId","buildTasks","join","tagTasks","snapTasks","exports"],"sources":["build.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport prettyTime from 'pretty-time';\nimport { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport chalk from 'chalk';\nimport { BuilderMain } from './builder.main.runtime';\n\ntype BuildOpts = {\n all: boolean; // deprecated. use unmodified\n unmodified?: boolean;\n dev: boolean;\n rebuild: boolean;\n install: boolean;\n cachePackagesOnCapsulesRoot: boolean;\n reuseCapsules: boolean;\n tasks: string;\n listTasks?: string;\n skipTests?: boolean;\n failFast?: boolean;\n includeSnap?: boolean;\n includeTag?: boolean;\n};\n\nexport class BuilderCmd implements Command {\n name = 'build [component-pattern]';\n description = 'run set of tasks for build.';\n extendedDescription = 'by default, only new and modified components are built';\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n helpUrl = 'reference/build-pipeline/builder-overview';\n alias = '';\n group = 'development';\n options = [\n ['a', 'all', 'DEPRECATED. use --unmodified'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are built)'],\n ['d', 'dev', 'run the pipeline in dev mode'],\n ['', 'install', 'install core aspects in capsules'],\n ['', 'reuse-capsules', 'avoid deleting the capsules root-dir before starting the build'],\n [\n '',\n 'tasks <string>',\n `build the specified task(s) only. for multiple tasks, separate by a comma and wrap with quotes.\nspecify the task-name (e.g. \"TypescriptCompiler\") or the task-aspect-id (e.g. teambit.compilation/compiler)`,\n ],\n ['', 'cache-packages-on-capsule-root', 'set the package-manager cache on the capsule root'],\n [\n '',\n 'list-tasks <string>',\n 'list tasks of an env or a component-id for each one of the pipelines: build, tag and snap',\n ],\n ['', 'skip-tests', 'skip running component tests during build process'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n '',\n 'include-snap',\n 'EXPERIMENTAL. include snap pipeline tasks. Warning: this may deploy/publish if you have such tasks',\n ],\n [\n '',\n 'include-tag',\n 'EXPERIMENTAL. include tag pipeline tasks. Warning: this may deploy/publish if you have such tasks',\n ],\n ] as CommandOptions;\n\n constructor(private builder: BuilderMain, private workspace: Workspace, private logger: Logger) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n unmodified = false,\n dev = false,\n install = false,\n cachePackagesOnCapsulesRoot = false,\n reuseCapsules = false,\n tasks,\n listTasks,\n skipTests,\n failFast,\n includeSnap,\n includeTag,\n }: BuildOpts\n ): Promise<string> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n if (all) {\n this.logger.consoleWarning(`--all is deprecated, please use --unmodified instead`);\n unmodified = true;\n }\n if (listTasks) {\n return this.getListTasks(listTasks);\n }\n\n this.logger.setStatusLine('build');\n const start = process.hrtime();\n const components = await this.workspace.getComponentsByUserInput(unmodified, pattern, true);\n if (!components.length) {\n return chalk.bold(\n `no components found to build. use \"--unmodified\" flag to build all components or specify the ids to build, otherwise, only new and modified components will be built`\n );\n }\n\n const envsExecutionResults = await this.builder.build(\n components,\n {\n installOptions: {\n installTeambitBit: install,\n packageManagerConfigRootDir: this.workspace.path,\n },\n linkingOptions: { linkTeambitBit: !install },\n emptyRootDir: !reuseCapsules,\n getExistingAsIs: reuseCapsules,\n cachePackagesOnCapsulesRoot,\n },\n {\n dev,\n tasks: tasks ? tasks.split(',').map((task) => task.trim()) : [],\n skipTests,\n exitOnFirstFailedTask: failFast,\n },\n {\n includeSnap,\n includeTag,\n }\n );\n this.logger.console(`build output can be found in path: ${envsExecutionResults.capsuleRootDir}`);\n const duration = prettyTime(process.hrtime(start));\n const succeedOrFailed = envsExecutionResults.hasErrors() ? 'failed' : 'succeeded';\n const msg = `build ${succeedOrFailed}. completed in ${duration}.`;\n if (envsExecutionResults.hasErrors()) {\n this.logger.consoleFailure(msg);\n }\n envsExecutionResults.throwErrorsIfExist();\n return chalk.green(msg);\n }\n\n private async getListTasks(componentIdStr: string): Promise<string> {\n const compId = await this.workspace.resolveComponentId(componentIdStr);\n const component = await this.workspace.get(compId);\n const results = this.builder.listTasks(component);\n return `${chalk.green('Task List')}\nid: ${results.id.toString()}\nenvId: ${results.envId}\n\n${chalk.bold('Build Pipeline Tasks:')}\n${results.buildTasks.join('\\n')}\n\n${chalk.bold('Tag Pipeline Tasks:')}\n${results.tagTasks.join('\\n')}\n\n${chalk.bold('Snap Pipeline Tasks:')}\n${results.snapTasks.join('\\n') || '<N/A>'}`;\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA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AACI,UAAU,CAACC,IAAI,CAAC,IAAI,CAAE;AAChC;AACA,EAAErC,gBAAK,CAACC,IAAI,CAAC,qBAAqB,CAAE;AACpC,EAAE+B,OAAO,CAACM,QAAQ,CAACD,IAAI,CAAC,IAAI,CAAE;AAC9B;AACA,EAAErC,gBAAK,CAACC,IAAI,CAAC,sBAAsB,CAAE;AACrC,EAAE+B,OAAO,CAACO,SAAS,CAACF,IAAI,CAAC,IAAI,CAAC,IAAI,OAAQ,EAAC;EACzC;AACF;AAACG,OAAA,CAAAxE,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_prettyTime","data","_interopRequireDefault","require","_workspace","_constants","_chalk","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","BuilderCmd","constructor","builder","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","dev","install","cachePackagesOnCapsulesRoot","reuseCapsules","tasks","listTasks","skipTests","failFast","includeSnap","includeTag","OutsideWorkspaceError","consoleWarning","getListTasks","setStatusLine","start","process","hrtime","components","getComponentsByUserInput","length","chalk","bold","envsExecutionResults","build","installOptions","installTeambitBit","packageManagerConfigRootDir","path","linkingOptions","linkTeambitBit","emptyRootDir","getExistingAsIs","split","map","task","trim","exitOnFirstFailedTask","console","capsuleRootDir","duration","prettyTime","succeedOrFailed","hasErrors","msg","consoleFailure","throwErrorsIfExist","green","componentIdStr","compId","resolveComponentId","component","get","results","id","toString","envId","buildTasks","join","tagTasks","snapTasks","exports"],"sources":["build.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport prettyTime from 'pretty-time';\nimport { OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';\nimport chalk from 'chalk';\nimport { BuilderMain } from './builder.main.runtime';\n\ntype BuildOpts = {\n all: boolean; // deprecated. use unmodified\n unmodified?: boolean;\n dev: boolean;\n rebuild: boolean;\n install: boolean;\n cachePackagesOnCapsulesRoot: boolean;\n reuseCapsules: boolean;\n tasks: string;\n listTasks?: string;\n skipTests?: boolean;\n failFast?: boolean;\n includeSnap?: boolean;\n includeTag?: boolean;\n};\n\nexport class BuilderCmd implements Command {\n name = 'build [component-pattern]';\n description = 'run set of tasks for build.';\n extendedDescription = 'by default, only new and modified components are built';\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n helpUrl = 'reference/build-pipeline/builder-overview';\n alias = '';\n group = 'development';\n options = [\n ['a', 'all', 'DEPRECATED. use --unmodified'],\n ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are built)'],\n ['d', 'dev', 'run the pipeline in dev mode'],\n ['', 'install', 'install core aspects in capsules'],\n ['', 'reuse-capsules', 'avoid deleting the capsules root-dir before starting the build'],\n [\n '',\n 'tasks <string>',\n `build the specified task(s) only. for multiple tasks, separate by a comma and wrap with quotes.\nspecify the task-name (e.g. \"TypescriptCompiler\") or the task-aspect-id (e.g. teambit.compilation/compiler)`,\n ],\n ['', 'cache-packages-on-capsule-root', 'set the package-manager cache on the capsule root'],\n [\n '',\n 'list-tasks <string>',\n 'list tasks of an env or a component-id for each one of the pipelines: build, tag and snap',\n ],\n ['', 'skip-tests', 'skip running component tests during build process'],\n [\n '',\n 'fail-fast',\n 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)',\n ],\n [\n '',\n 'include-snap',\n 'EXPERIMENTAL. include snap pipeline tasks. Warning: this may deploy/publish if you have such tasks',\n ],\n [\n '',\n 'include-tag',\n 'EXPERIMENTAL. include tag pipeline tasks. Warning: this may deploy/publish if you have such tasks',\n ],\n ] as CommandOptions;\n\n constructor(private builder: BuilderMain, private workspace: Workspace, private logger: Logger) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n unmodified = false,\n dev = false,\n install = false,\n cachePackagesOnCapsulesRoot = false,\n reuseCapsules = false,\n tasks,\n listTasks,\n skipTests,\n failFast,\n includeSnap,\n includeTag,\n }: BuildOpts\n ): Promise<string> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n if (all) {\n this.logger.consoleWarning(`--all is deprecated, please use --unmodified instead`);\n unmodified = true;\n }\n if (listTasks) {\n return this.getListTasks(listTasks);\n }\n\n this.logger.setStatusLine('build');\n const start = process.hrtime();\n const components = await this.workspace.getComponentsByUserInput(unmodified, pattern, true);\n if (!components.length) {\n return chalk.bold(\n `no components found to build. use \"--unmodified\" flag to build all components or specify the ids to build, otherwise, only new and modified components will be built`\n );\n }\n\n const envsExecutionResults = await this.builder.build(\n components,\n {\n installOptions: {\n installTeambitBit: install,\n packageManagerConfigRootDir: this.workspace.path,\n },\n linkingOptions: { linkTeambitBit: !install },\n emptyRootDir: !reuseCapsules,\n getExistingAsIs: reuseCapsules,\n cachePackagesOnCapsulesRoot,\n },\n {\n dev,\n tasks: tasks ? tasks.split(',').map((task) => task.trim()) : [],\n skipTests,\n exitOnFirstFailedTask: failFast,\n },\n {\n includeSnap,\n includeTag,\n }\n );\n this.logger.console(`build output can be found in path: ${envsExecutionResults.capsuleRootDir}`);\n const duration = prettyTime(process.hrtime(start));\n const succeedOrFailed = envsExecutionResults.hasErrors() ? 'failed' : 'succeeded';\n const msg = `build ${succeedOrFailed}. completed in ${duration}.`;\n if (envsExecutionResults.hasErrors()) {\n this.logger.consoleFailure(msg);\n }\n envsExecutionResults.throwErrorsIfExist();\n return chalk.green(msg);\n }\n\n private async getListTasks(componentIdStr: string): Promise<string> {\n const compId = await this.workspace.resolveComponentId(componentIdStr);\n const component = await this.workspace.get(compId);\n const results = this.builder.listTasks(component);\n return `${chalk.green('Task List')}\nid: ${results.id.toString()}\nenvId: ${results.envId}\n\n${chalk.bold('Build Pipeline Tasks:')}\n${results.buildTasks.join('\\n')}\n\n${chalk.bold('Tag Pipeline Tasks:')}\n${results.tagTasks.join('\\n')}\n\n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,SAASM,OAAO,CAACC,EAAE,CAACC,QAAQ,CAAC,CAAE;AAC/B,SAASF,OAAO,CAACG,KAAM;AACvB;AACA,EAAEnC,gBAAK,CAACC,IAAI,CAAC,uBAAuB,CAAE;AACtC,EAAE+B,OAAO,CAACI,UAAU,CAACC,IAAI,CAAC,IAAI,CAAE;AAChC;AACA,EAAErC,gBAAK,CAACC,IAAI,CAAC,qBAAqB,CAAE;AACpC,EAAE+B,OAAO,CAACM,QAAQ,CAACD,IAAI,CAAC,IAAI,CAAE;AAC9B;AACA,EAAErC,gBAAK,CAACC,IAAI,CAAC,sBAAsB,CAAE;AACrC,EAAE+B,OAAO,CAACO,SAAS,CAACF,IAAI,CAAC,IAAI,CAAC,IAAI,OAAQ,EAAC;EACzC;AACF;AAACG,OAAA,CAAAxE,UAAA,GAAAA,UAAA","ignoreList":[]}
|
package/dist/builder.graphql.js
CHANGED
|
@@ -22,7 +22,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
24
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
26
26
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
27
|
function builderSchema(builder, logger) {
|
|
28
28
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphqlTag","data","require","_isBinaryPath","_interopRequireDefault","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","builderSchema","builder","logger","typeDefs","gql","resolvers","Component","pipelineReport","component","taskId","builderData","getBuilderData","pipeline","artifacts","getArtifactsByAspect","getArtifacts","artifactsWithVinyl","Promise","all","map","artifact","id","task","aspectId","name","artifactFiles","getArtifactsVinylByAspectAndTaskName","vinyl","basename","path","contents","isBinary","isBinaryPath","content","toString","undefined","size","byteLength","downloadUrl","encodeURI","getDownloadUrlForArtifact","externalUrl","url","description","storage","generatedBy","files","error","result","find","taskName","TaskReport","taskReport","taskDescription","errors","warnings","pathFilter","file"],"sources":["builder.graphql.ts"],"sourcesContent":["import { Component, ComponentID } from '@teambit/component';\nimport { gql } from 'graphql-tag';\nimport { Logger } from '@teambit/logger';\nimport isBinaryPath from 'is-binary-path';\nimport { BuilderMain } from './builder.main.runtime';\nimport { PipelineReport } from './build-pipeline-result-list';\n\ntype ArtifactGQLFile = {\n /**\n * same as the path - used for GQL caching\n */\n id: string;\n /**\n * name of the artifact file\n */\n name: string;\n /**\n * path of the artifact file\n */\n path: string;\n /**\n * artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n */\n content?: string;\n /**\n * REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat\n */\n downloadUrl?: string;\n /**\n * Remote storage url to resolve artifact file from\n */\n externalUrl?: string;\n /**\n * Size in bytes\n */\n size: number;\n};\n\ntype ArtifactGQLData = {\n name: string;\n description?: string;\n storage?: string;\n generatedBy: string;\n files: ArtifactGQLFile[];\n};\ntype TaskReport = PipelineReport & {\n artifact?: ArtifactGQLData;\n componentId: ComponentID;\n};\n\nexport function builderSchema(builder: BuilderMain, logger: Logger) {\n return {\n typeDefs: gql`\n type TaskReport {\n # for GQL caching - taskId + taskName\n id: String!\n taskId: String!\n taskName: String!\n description: String\n startTime: String\n endTime: String\n errors: [String!]\n warnings: [String!]\n artifact(path: String): Artifact\n }\n\n type ArtifactFile {\n # for GQL caching - same as the path\n id: String!\n # name of the artifact file\n name: String\n # path of the artifact file\n path: String!\n # artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n content: String\n # REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<path>\n downloadUrl: String\n # Remote storage url to resolve artifact file from\n externalUrl: String\n # size in bytes\n size: Int!\n }\n\n type Artifact {\n # for GQL caching - PipelineId + Artifact Name\n id: String!\n # artifact name\n name: String!\n description: String\n storage: String\n generatedBy: String\n files: [ArtifactFile!]!\n }\n\n extend type Component {\n pipelineReport(taskId: String): [TaskReport!]!\n }\n `,\n\n resolvers: {\n Component: {\n pipelineReport: async (component: Component, { taskId }: { taskId?: string }) => {\n try {\n const builderData = builder.getBuilderData(component);\n const pipeline = builderData?.pipeline || [];\n const artifacts = taskId\n ? builder.getArtifactsByAspect(component, taskId)\n : builder.getArtifacts(component);\n const artifactsWithVinyl = await Promise.all(\n artifacts.map(async (artifact) => {\n const id = artifact.task.aspectId;\n const name = artifact.task.name as string;\n try {\n const artifactFiles = (await builder.getArtifactsVinylByAspectAndTaskName(component, id, name)).map(\n (vinyl) => {\n const { basename, path, contents } = vinyl || {};\n const isBinary = path && isBinaryPath(path);\n const content = !isBinary ? contents?.toString('utf-8') : undefined;\n const size = contents.byteLength;\n const downloadUrl = encodeURI(\n builder.getDownloadUrlForArtifact(component.id, artifact.task.aspectId, path)\n );\n const externalUrl = vinyl.url;\n return { id: path, name: basename, path, content, downloadUrl, externalUrl, size };\n }\n );\n return {\n id: `${id}-${name}-${artifact.name}`,\n name: artifact.name,\n description: artifact.description,\n task: artifact.task,\n storage: artifact.storage,\n generatedBy: artifact.generatedBy,\n files: artifactFiles,\n };\n } catch (e: any) {\n logger.error(e.toString());\n return {\n id: `${id}-${name}-${artifact.name}`,\n name: artifact.name,\n description: artifact.description,\n task: artifact.task,\n storage: artifact.storage,\n generatedBy: artifact.generatedBy,\n files: [],\n };\n }\n })\n );\n\n const result = pipeline\n .filter((task) => !taskId || task.taskId === taskId)\n .map((task) => ({\n ...task,\n id: `filter-${taskId || ''}`,\n artifact: artifactsWithVinyl.find(\n (data) => data.task.aspectId === task.taskId && data.task.name === task.taskName\n ),\n }));\n\n return result;\n } catch (e: any) {\n logger.error(e.toString());\n return [];\n }\n },\n },\n TaskReport: {\n id: (taskReport: TaskReport & { id?: string }) =>\n `${(taskReport.id && `${taskReport.id}-`) || ''}${taskReport.taskId}-${taskReport.taskName}`,\n description: (taskReport: TaskReport) => taskReport.taskDescription,\n errors: (taskReport: TaskReport) => taskReport.errors?.map((e) => e.toString()) || [],\n warnings: (taskReport: TaskReport) => taskReport.warnings || [],\n artifact: async (taskReport: TaskReport, { path: pathFilter }: { path?: string }) => {\n if (!taskReport.artifact) return undefined;\n return {\n id: `${taskReport.taskId}-${taskReport.taskName}-${taskReport.artifact?.name}-${pathFilter || ''}`,\n ...taskReport.artifact,\n files: taskReport.artifact.files.filter((file) => !pathFilter || file.path === pathFilter),\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,SA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,CAAChC,QAAQ;YACtB0B,KAAK,EAAEM,UAAU,CAAChC,QAAQ,CAAC0B,KAAK,CAACxE,MAAM,CAAEmF,IAAI,IAAK,CAACD,UAAU,IAAIC,IAAI,CAAC5B,IAAI,KAAK2B,UAAU;UAAC;QAE9F;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_graphqlTag","data","require","_isBinaryPath","_interopRequireDefault","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","builderSchema","builder","logger","typeDefs","gql","resolvers","Component","pipelineReport","component","taskId","builderData","getBuilderData","pipeline","artifacts","getArtifactsByAspect","getArtifacts","artifactsWithVinyl","Promise","all","map","artifact","id","task","aspectId","name","artifactFiles","getArtifactsVinylByAspectAndTaskName","vinyl","basename","path","contents","isBinary","isBinaryPath","content","toString","undefined","size","byteLength","downloadUrl","encodeURI","getDownloadUrlForArtifact","externalUrl","url","description","storage","generatedBy","files","error","result","find","taskName","TaskReport","taskReport","taskDescription","errors","warnings","pathFilter","file"],"sources":["builder.graphql.ts"],"sourcesContent":["import { Component, ComponentID } from '@teambit/component';\nimport { gql } from 'graphql-tag';\nimport { Logger } from '@teambit/logger';\nimport isBinaryPath from 'is-binary-path';\nimport { BuilderMain } from './builder.main.runtime';\nimport { PipelineReport } from './build-pipeline-result-list';\n\ntype ArtifactGQLFile = {\n /**\n * same as the path - used for GQL caching\n */\n id: string;\n /**\n * name of the artifact file\n */\n name: string;\n /**\n * path of the artifact file\n */\n path: string;\n /**\n * artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n */\n content?: string;\n /**\n * REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat\n */\n downloadUrl?: string;\n /**\n * Remote storage url to resolve artifact file from\n */\n externalUrl?: string;\n /**\n * Size in bytes\n */\n size: number;\n};\n\ntype ArtifactGQLData = {\n name: string;\n description?: string;\n storage?: string;\n generatedBy: string;\n files: ArtifactGQLFile[];\n};\ntype TaskReport = PipelineReport & {\n artifact?: ArtifactGQLData;\n componentId: ComponentID;\n};\n\nexport function builderSchema(builder: BuilderMain, logger: Logger) {\n return {\n typeDefs: gql`\n type TaskReport {\n # for GQL caching - taskId + taskName\n id: String!\n taskId: String!\n taskName: String!\n description: String\n startTime: String\n endTime: String\n errors: [String!]\n warnings: [String!]\n artifact(path: String): Artifact\n }\n\n type ArtifactFile {\n # for GQL caching - same as the path\n id: String!\n # name of the artifact file\n name: String\n # path of the artifact file\n path: String!\n # artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n content: String\n # REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<path>\n downloadUrl: String\n # Remote storage url to resolve artifact file from\n externalUrl: String\n # size in bytes\n size: Int!\n }\n\n type Artifact {\n # for GQL caching - PipelineId + Artifact Name\n id: String!\n # artifact name\n name: String!\n description: String\n storage: String\n generatedBy: String\n files: [ArtifactFile!]!\n }\n\n extend type Component {\n pipelineReport(taskId: String): [TaskReport!]!\n }\n `,\n\n resolvers: {\n Component: {\n pipelineReport: async (component: Component, { taskId }: { taskId?: string }) => {\n try {\n const builderData = builder.getBuilderData(component);\n const pipeline = builderData?.pipeline || [];\n const artifacts = taskId\n ? builder.getArtifactsByAspect(component, taskId)\n : builder.getArtifacts(component);\n const artifactsWithVinyl = await Promise.all(\n artifacts.map(async (artifact) => {\n const id = artifact.task.aspectId;\n const name = artifact.task.name as string;\n try {\n const artifactFiles = (await builder.getArtifactsVinylByAspectAndTaskName(component, id, name)).map(\n (vinyl) => {\n const { basename, path, contents } = vinyl || {};\n const isBinary = path && isBinaryPath(path);\n const content = !isBinary ? contents?.toString('utf-8') : undefined;\n const size = contents.byteLength;\n const downloadUrl = encodeURI(\n builder.getDownloadUrlForArtifact(component.id, artifact.task.aspectId, path)\n );\n const externalUrl = vinyl.url;\n return { id: path, name: basename, path, content, downloadUrl, externalUrl, size };\n }\n );\n return {\n id: `${id}-${name}-${artifact.name}`,\n name: artifact.name,\n description: artifact.description,\n task: artifact.task,\n storage: artifact.storage,\n generatedBy: artifact.generatedBy,\n files: artifactFiles,\n };\n } catch (e: any) {\n logger.error(e.toString());\n return {\n id: `${id}-${name}-${artifact.name}`,\n name: artifact.name,\n description: artifact.description,\n task: artifact.task,\n storage: artifact.storage,\n generatedBy: artifact.generatedBy,\n files: [],\n };\n }\n })\n );\n\n const result = pipeline\n .filter((task) => !taskId || task.taskId === taskId)\n .map((task) => ({\n ...task,\n id: `filter-${taskId || ''}`,\n artifact: artifactsWithVinyl.find(\n (data) => data.task.aspectId === task.taskId && data.task.name === task.taskName\n ),\n }));\n\n return result;\n } catch (e: any) {\n logger.error(e.toString());\n return [];\n }\n },\n },\n TaskReport: {\n id: (taskReport: TaskReport & { id?: string }) =>\n `${(taskReport.id && `${taskReport.id}-`) || ''}${taskReport.taskId}-${taskReport.taskName}`,\n description: (taskReport: TaskReport) => taskReport.taskDescription,\n errors: (taskReport: TaskReport) => taskReport.errors?.map((e) => e.toString()) || [],\n warnings: (taskReport: TaskReport) => taskReport.warnings || [],\n artifact: async (taskReport: TaskReport, { path: pathFilter }: { path?: string }) => {\n if (!taskReport.artifact) return undefined;\n return {\n id: `${taskReport.taskId}-${taskReport.taskName}-${taskReport.artifact?.name}-${pathFilter || ''}`,\n ...taskReport.artifact,\n files: taskReport.artifact.files.filter((file) => !pathFilter || file.path === pathFilter),\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;A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I,CAAC5B,IAAI,KAAK2B,UAAU;UAAC;QAE9F;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -218,7 +218,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
218
218
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
219
219
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
220
220
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
221
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
221
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
222
222
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // it gets undefined when importing it from './artifact'
|
|
223
223
|
const FILE_PATH_PARAM_DELIM = exports.FILE_PATH_PARAM_DELIM = '~';
|
|
224
224
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","data","require","_artifactFiles","_aspectLoader","_cli","_component","_envs","_graphql","_harmony","_globalConfig","_logger","_aspect","_interopRequireDefault","_scope","_workspace","_isolator","_bootstrap","_toolboxArray","_generator","_ui","_artifact","_artifactFactory","_builder","_builder2","_builder3","_build","_buildTask","_exceptions","_buildPipelineResultList","_artifacts","_buildTask2","_builder4","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","FILE_PATH_PARAM_DELIM","exports","BuilderMain","constructor","envs","workspace","buildService","tagService","snapService","scope","isolator","aspectLoader","componentAspect","globalConfig","buildTaskSlot","tagTaskSlot","snapTaskSlot","logger","storeArtifacts","tasksResults","artifacts","flatMap","storeP","map","artifactMap","Promise","all","toArray","component","artifactList","store","err","ArtifactStorageError","pipelineResultsToBuilderData","components","buildPipelineResults","buildPipelineResultList","BuildPipelineResultList","ComponentMap","as","aspectsData","getDataOfComponent","id","pipelineReport","getPipelineReportOfComponent","getArtifactsDataOfComponent","pipeline","bitVersion","getHarmonyVersion","tagListener","options","isolateOptions","builderOptions","pipeResults","allTasksResults","throwOnError","forceDeploy","disableTagAndSnapPipelines","isSnap","populateArtifactsFrom","buildEnvsExecutionResults","build","emptyRootDir","tasks","AspectAspect","undefined","throwErrorsIfExist","hasErrors","builderOptionsForTagSnap","seedersOnly","previousTasksResults","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","combineBuildDataFrom","validateBuilderDataMap","sanitizePreviewData","harmonyComps","compsBeingTaggedLookup","Set","comp","toString","harmonyCompIdsWithEnvId","envId","getEnvId","isUsingCoreEnv","inWs","lastTaggedEnvHasOnlyOverview","has","isEnvTaggedWithComp","envCompId","ComponentID","fromString","hasId","get","state","aspects","onlyOverview","harmonyCompIdsWithEnvIdMap","Map","compsToDeleteOnlyOverviewPreviewData","envData","previewData","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","Error","join","promises","builderData","populateFrom","find","isEqual","ignoreVersion","idStr","populateFromComp","getHost","version","populateFromBuilderData","getBuilderData","artifact","artifactObj","toObject","a","task","aspectData","p","flattenValue","getArtifactsVinylByAspect","aspectName","getArtifactsByAspect","vinyls","getVinylsAndImportIfMissing","legacyScope","getArtifactsVinylByAspectAndName","getArtifactsByAspectAndName","getArtifactsVinylByAspectAndTaskName","getArtifactsbyAspectAndTaskName","getArtifactsByName","getArtifacts","byAspectNameAndName","byAspectNameAndTaskName","getDataByAspect","ArtifactList","fromArray","BuilderAspect","clonedData","cloneDeep","artifactFiles","files","ArtifactFiles","fromObject","Artifact","assign","fromArtifactObject","extraOptions","ids","c","capsulesBaseDir","getComponentsCapsulesBaseDir","baseIsolateOpts","baseDir","useHash","mergedIsolateOpts","network","isolateComponents","createEnvironment","graphCapsules","getAllComponents","builderServiceOptions","originalSeeders","consoleTitle","buildResult","runOnce","includeSnap","includeTag","listTasks","compEnv","getEnv","buildTasks","getCurrentPipeTasks","tagTasks","snapTasks","registerBuildTasks","register","registerDeployTasks","registerTagTasks","registerSnapTasks","getDownloadUrlForArtifact","componentId","path","provider","cli","loggerExt","graphql","generator","ui","config","artifactFactory","ArtifactFactory","createLogger","BuilderService","registerService","builder","BundleUiTask","registerRoute","BuilderRoute","builderSchema","registerComponentTemplate","buildTaskTemplate","commands","BuilderCmd","ArtifactsCmd","Slot","withType","MainRuntime","CLIAspect","EnvsAspect","WorkspaceAspect","ScopeAspect","IsolatorAspect","LoggerAspect","AspectLoaderAspect","GraphqlAspect","GeneratorAspect","ComponentAspect","UIAspect","GlobalConfigAspect","addRuntime"],"sources":["builder.main.runtime.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\nimport { ArtifactFiles, ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentMap, IComponent, ComponentAspect, ComponentMain, ComponentID } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport AspectAspect from '@teambit/aspect';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { IsolateComponentsOptions, IsolatorAspect, IsolatorMain } from '@teambit/isolator';\nimport { getHarmonyVersion } from '@teambit/legacy/dist/bootstrap';\nimport { findDuplications } from '@teambit/toolbox.array.duplications-finder';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { UIAspect, UiMain, BundleUiTask } from '@teambit/ui';\nimport { Artifact, ArtifactList, FsArtifact } from './artifact';\nimport { ArtifactFactory } from './artifact/artifact-factory'; // it gets undefined when importing it from './artifact'\nimport { BuilderAspect } from './builder.aspect';\nimport { builderSchema } from './builder.graphql';\nimport { BuilderService, BuilderServiceOptions } from './builder.service';\nimport { BuilderCmd } from './build.cmd';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { ArtifactStorageError } from './exceptions';\nimport { BuildPipelineResultList, AspectData, PipelineReport } from './build-pipeline-result-list';\nimport { TaskMetadata } from './types';\nimport { ArtifactsCmd } from './artifact/artifacts.cmd';\nimport { buildTaskTemplate } from './templates/build-task';\nimport { BuilderRoute } from './builder.route';\n\nexport type TaskSlot = SlotRegistry<BuildTask[]>;\nexport type OnTagResults = { builderDataMap: ComponentMap<RawBuilderData>; pipeResults: TaskResultsList[] };\nexport type OnTagOpts = {\n disableTagAndSnapPipelines?: boolean;\n throwOnError?: boolean; // on the CI it helps to save the results on failure so this is set to false\n forceDeploy?: boolean; // whether run the deploy-pipeline although the build-pipeline has failed\n populateArtifactsFrom?: ComponentID[]; // helpful for tagging from scope where we want to use the build-artifacts of previous snap.\n isSnap?: boolean;\n};\nexport const FILE_PATH_PARAM_DELIM = '~';\n\n/**\n * builder data format for the bit object store\n */\nexport type RawBuilderData = {\n pipeline: PipelineReport[];\n artifacts?: ArtifactObject[];\n aspectsData: AspectData[];\n bitVersion?: string;\n};\n/**\n * builder data mapped to an ArtifactList instance\n */\nexport type BuilderData = Omit<RawBuilderData, 'artifacts'> & {\n artifacts: ArtifactList<Artifact>;\n};\n\nexport class BuilderMain {\n constructor(\n private envs: EnvsMain,\n private workspace: Workspace,\n private buildService: BuilderService,\n private tagService: BuilderService,\n private snapService: BuilderService,\n private scope: ScopeMain,\n private isolator: IsolatorMain,\n private aspectLoader: AspectLoaderMain,\n private componentAspect: ComponentMain,\n private globalConfig: GlobalConfigMain,\n private buildTaskSlot: TaskSlot,\n private tagTaskSlot: TaskSlot,\n private snapTaskSlot: TaskSlot,\n private logger: Logger\n ) {}\n\n private async storeArtifacts(tasksResults: TaskResults[]) {\n const artifacts = tasksResults.flatMap((t) => (t.artifacts ? [t.artifacts] : []));\n const storeP = artifacts.map(async (artifactMap: ComponentMap<ArtifactList<FsArtifact>>) => {\n return Promise.all(\n artifactMap.toArray().map(async ([component, artifactList]) => {\n try {\n return await artifactList.store(component);\n } catch (err: any) {\n throw new ArtifactStorageError(err, component);\n }\n })\n );\n });\n await Promise.all(storeP);\n }\n\n pipelineResultsToBuilderData(\n components: Component[],\n buildPipelineResults: TaskResults[]\n ): ComponentMap<RawBuilderData> {\n const buildPipelineResultList = new BuildPipelineResultList(buildPipelineResults, components);\n return ComponentMap.as<RawBuilderData>(components, (component) => {\n const aspectsData = buildPipelineResultList.getDataOfComponent(component.id);\n const pipelineReport = buildPipelineResultList.getPipelineReportOfComponent(component.id);\n const artifacts = buildPipelineResultList.getArtifactsDataOfComponent(component.id);\n return { pipeline: pipelineReport, artifacts, aspectsData, bitVersion: getHarmonyVersion(true) };\n });\n }\n\n async tagListener(\n components: Component[],\n options: OnTagOpts = {},\n isolateOptions: IsolateComponentsOptions = {},\n builderOptions: BuilderServiceOptions = {}\n ): Promise<OnTagResults> {\n const pipeResults: TaskResultsList[] = [];\n const allTasksResults: TaskResults[] = [];\n const { throwOnError, forceDeploy, disableTagAndSnapPipelines, isSnap, populateArtifactsFrom } = options;\n if (populateArtifactsFrom) isolateOptions.populateArtifactsFrom = populateArtifactsFrom;\n const buildEnvsExecutionResults = await this.build(\n components,\n { emptyRootDir: true, ...isolateOptions },\n {\n ...builderOptions,\n // even when build is skipped (in case of tag-from-scope), the pre-build/post-build and teambit.harmony/aspect tasks are needed\n tasks: populateArtifactsFrom ? [AspectAspect.id] : undefined,\n }\n );\n if (throwOnError && !forceDeploy) buildEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...buildEnvsExecutionResults.tasksResults);\n pipeResults.push(buildEnvsExecutionResults);\n\n if (forceDeploy || (!disableTagAndSnapPipelines && !buildEnvsExecutionResults?.hasErrors())) {\n const builderOptionsForTagSnap: BuilderServiceOptions = {\n ...builderOptions,\n seedersOnly: isolateOptions.seedersOnly,\n previousTasksResults: buildEnvsExecutionResults?.tasksResults,\n };\n const deployEnvsExecutionResults = isSnap\n ? await this.runSnapTasks(components, builderOptionsForTagSnap)\n : await this.runTagTasks(components, builderOptionsForTagSnap);\n if (throwOnError && !forceDeploy) deployEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...deployEnvsExecutionResults.tasksResults);\n pipeResults.push(deployEnvsExecutionResults);\n }\n await this.storeArtifacts(allTasksResults);\n const builderDataMap = this.pipelineResultsToBuilderData(components, allTasksResults);\n if (populateArtifactsFrom) await this.combineBuildDataFrom(builderDataMap, populateArtifactsFrom);\n this.validateBuilderDataMap(builderDataMap);\n\n await this.sanitizePreviewData(components);\n\n return { builderDataMap, pipeResults };\n }\n\n /**\n * remove the onlyOverview from the preview data of the component if\n * the env is in the workspace\n * the env is not tagged with the component\n * the last tagged env has onlyOverview undefined in preview data\n *\n * We don't want to do this but have no choice because,\n * when we load components in workspace,\n * we set the onlyOverview to true in the env's preview data\n * which sets the onlyOverview to true in the component's preview data\n * but if you don't tag the env with the component,\n * the onlyOverview will be true in the component's preview data, since its env is in the workspace\n * even though the env it is tagged with doesn't have onlyOverview in its preview data\n * which will result in inconsistent preview data when exported to the scope\n */\n async sanitizePreviewData(harmonyComps: Component[]) {\n const compsBeingTaggedLookup = new Set(harmonyComps.map((comp) => comp.id.toString()));\n\n const harmonyCompIdsWithEnvId = await Promise.all(\n harmonyComps.map(async (comp) => {\n const envId = await this.envs.getEnvId(comp);\n if (this.envs.isUsingCoreEnv(comp)) {\n return [comp.id.toString(), { envId, inWs: false, lastTaggedEnvHasOnlyOverview: false }] as [\n string,\n { envId: string; inWs: boolean; lastTaggedEnvHasOnlyOverview?: boolean; isEnvTaggedWithComp?: boolean }\n ];\n }\n\n // check if the env is tagged with the component\n if (envId && !compsBeingTaggedLookup.has(comp.id.toString())) {\n return [comp.id.toString(), { envId, isEnvTaggedWithComp: false }] as [\n string,\n { envId: string; inWs?: boolean; lastTaggedEnvHasOnlyOverview?: boolean; isEnvTaggedWithComp?: boolean }\n ];\n }\n\n const envCompId = (envId && ComponentID.fromString(envId)) || undefined;\n const inWs = this.workspace && envCompId ? await this.workspace.hasId(envCompId) : false;\n\n const lastTaggedEnvHasOnlyOverview: boolean | undefined =\n envCompId &&\n (await this.scope.get(envCompId, false))?.state.aspects.get('teambit.preview/preview')?.data?.onlyOverview;\n\n return [comp.id.toString(), { envId, inWs, lastTaggedEnvHasOnlyOverview, isEnvTaggedWithComp: true }] as [\n string,\n { envId: string; inWs: boolean; lastTaggedEnvHasOnlyOverview: boolean; isEnvTaggedWithComp?: boolean }\n ];\n })\n );\n\n const harmonyCompIdsWithEnvIdMap = new Map(harmonyCompIdsWithEnvId);\n\n const compsToDeleteOnlyOverviewPreviewData = harmonyComps.filter((comp) => {\n const envData:\n | { envId: string; inWs?: boolean; lastTaggedEnvHasOnlyOverview?: boolean; isEnvTaggedWithComp?: boolean }\n | undefined = harmonyCompIdsWithEnvIdMap.get(comp.id.toString());\n return envData?.inWs && !envData?.lastTaggedEnvHasOnlyOverview && envData?.isEnvTaggedWithComp;\n });\n\n for (const comp of compsToDeleteOnlyOverviewPreviewData) {\n const previewData = comp.state.aspects.get('teambit.preview/preview')?.data;\n // if the env is not tagged with the component remove it from the preview data of the component\n delete previewData?.onlyOverview;\n }\n }\n\n private validateBuilderDataMap(builderDataMap: ComponentMap<RawBuilderData>) {\n builderDataMap.forEach((buildData: RawBuilderData, component) => {\n const taskSerializedIds = buildData.pipeline.map((t) =>\n BuildTaskHelper.serializeId({ aspectId: t.taskId, name: t.taskName })\n );\n const duplications = findDuplications(taskSerializedIds);\n if (duplications.length) {\n throw new Error(\n `build-task-results validation has failed. the following task(s) of \"${component.id.toString()}\" are duplicated: ${duplications.join(\n ', '\n )}`\n );\n }\n });\n }\n\n private async combineBuildDataFrom(\n builderDataMap: ComponentMap<RawBuilderData>,\n populateArtifactsFrom: ComponentID[]\n ) {\n const promises = builderDataMap.map(async (builderData, component) => {\n const populateFrom = populateArtifactsFrom.find((id) => id.isEqual(component.id, { ignoreVersion: true }));\n const idStr = component.id.toString();\n if (!populateFrom) {\n throw new Error(`combineBuildDataFromParent: unable to find where to populate the artifacts from for ${idStr}`);\n }\n const populateFromComp = await this.componentAspect.getHost().get(populateFrom);\n if (!populateFromComp)\n throw new Error(\n `combineBuildDataFromParent, unable to load parent component of ${idStr}. hash: ${populateFrom.version}`\n );\n const populateFromBuilderData = this.getBuilderData(populateFromComp);\n if (!populateFromBuilderData) throw new Error(`parent of ${idStr} was not built yet. unable to continue`);\n populateFromBuilderData.artifacts.forEach((artifact) => {\n const artifactObj = artifact.toObject();\n if (!builderData.artifacts) builderData.artifacts = [];\n if (\n builderData.artifacts.find(\n (a) =>\n a.task.id === artifactObj.task.id && a.task.name === artifactObj.task.name && a.name === artifactObj.name\n )\n ) {\n return;\n }\n builderData.artifacts.push(artifactObj);\n });\n populateFromBuilderData.aspectsData.forEach((aspectData) => {\n if (builderData.aspectsData.find((a) => a.aspectId === aspectData.aspectId)) return;\n builderData.aspectsData.push(aspectData);\n });\n populateFromBuilderData.pipeline.forEach((pipeline) => {\n if (builderData.pipeline.find((p) => p.taskId === pipeline.taskId && p.taskName === pipeline.taskName)) return;\n builderData.pipeline.push(pipeline);\n });\n });\n\n await Promise.all(promises.flattenValue());\n }\n\n // TODO: merge with getArtifactsVinylByExtensionAndName by getting aspect name and name as object with optional props\n async getArtifactsVinylByAspect(component: Component, aspectName: string): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspect(component, aspectName);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspectAndName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndTaskName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsbyAspectAndTaskName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n return vinyls;\n }\n\n getArtifactsByName(component: Component, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(undefined, name);\n return artifacts;\n }\n\n getArtifactsByAspect(component: Component, aspectName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName);\n return artifacts;\n }\n\n getArtifactsByAspectAndName(component: Component, aspectName: string, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName, name);\n return artifacts;\n }\n\n getArtifactsbyAspectAndTaskName(component: IComponent, aspectName: string, taskName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndTaskName(aspectName, taskName);\n return artifacts;\n }\n\n /**\n * this is the aspect's data that was generated as \"metadata\" of the task component-result during the build process\n * and saved by the builder aspect in the \"aspectsData\" property.\n * (not to be confused with the data saved in the aspect itself, which is saved in the \"data\" property of the aspect).\n */\n getDataByAspect(component: IComponent, aspectName: string): TaskMetadata | undefined {\n const aspectsData = this.getBuilderData(component)?.aspectsData;\n const data = aspectsData?.find((aspectData) => aspectData.aspectId === aspectName);\n return data?.data;\n }\n\n getArtifacts(component: IComponent): ArtifactList<Artifact> {\n const artifacts = this.getBuilderData(component)?.artifacts || ArtifactList.fromArray([]);\n return artifacts;\n }\n\n getBuilderData(component: IComponent): BuilderData | undefined {\n const data = component.get(BuilderAspect.id)?.data;\n if (!data) return undefined;\n const clonedData = cloneDeep(data) as BuilderData;\n let artifactFiles: ArtifactFiles;\n const artifacts = clonedData.artifacts?.map((artifact) => {\n if (!(artifact.files instanceof ArtifactFiles)) {\n artifactFiles = ArtifactFiles.fromObject(artifact.files);\n } else {\n artifactFiles = artifact.files;\n }\n if (artifact instanceof Artifact) {\n return artifact;\n }\n Object.assign(artifact, { files: artifactFiles });\n return Artifact.fromArtifactObject(artifact);\n });\n clonedData.artifacts = ArtifactList.fromArray(artifacts || []);\n return clonedData;\n }\n\n async build(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n builderOptions?: BuilderServiceOptions,\n extraOptions?: { includeTag?: boolean; includeSnap?: boolean }\n ): Promise<TaskResultsList> {\n const ids = components.map((c) => c.id);\n const capsulesBaseDir = this.buildService.getComponentsCapsulesBaseDir();\n const baseIsolateOpts = {\n baseDir: capsulesBaseDir,\n useHash: !capsulesBaseDir,\n };\n const mergedIsolateOpts = {\n ...baseIsolateOpts,\n ...isolateOptions,\n };\n\n const network = await this.isolator.isolateComponents(ids, mergedIsolateOpts, this.scope.legacyScope);\n const envs = await this.envs.createEnvironment(network.graphCapsules.getAllComponents());\n const builderServiceOptions = {\n seedersOnly: isolateOptions?.seedersOnly,\n originalSeeders: ids,\n capsulesBaseDir,\n ...(builderOptions || {}),\n };\n this.logger.consoleTitle(`Total ${components.length} components to build`);\n const buildResult: TaskResultsList = await envs.runOnce(this.buildService, builderServiceOptions);\n\n if (extraOptions?.includeSnap || extraOptions?.includeTag) {\n const builderOptionsForTagSnap: BuilderServiceOptions = {\n ...builderServiceOptions,\n previousTasksResults: buildResult.tasksResults,\n };\n const deployEnvsExecutionResults = extraOptions?.includeSnap\n ? await this.runSnapTasks(components, builderOptionsForTagSnap)\n : await this.runTagTasks(components, builderOptionsForTagSnap);\n buildResult.tasksResults.push(...deployEnvsExecutionResults.tasksResults);\n }\n\n return buildResult;\n }\n\n async runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.tagService, builderOptions);\n\n return buildResult;\n }\n\n async runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.snapService, builderOptions);\n\n return buildResult;\n }\n\n listTasks(component: Component) {\n const compEnv = this.envs.getEnv(component);\n const buildTasks = this.buildService.getCurrentPipeTasks(compEnv);\n const tagTasks = this.tagService.getCurrentPipeTasks(compEnv);\n const snapTasks = this.snapService.getCurrentPipeTasks(compEnv);\n return { id: component.id, envId: compEnv.id, buildTasks, tagTasks, snapTasks };\n }\n\n /**\n * register a build task to apply on all component build pipelines.\n * build happens on `bit build` and as part of `bit tag --persist`.\n */\n registerBuildTasks(tasks: BuildTask[]) {\n this.buildTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * @deprecated use registerTagTasks or registerSnapTasks\n */\n registerDeployTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit tag'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerTagTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit snap'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerSnapTasks(tasks: BuildTask[]) {\n this.snapTaskSlot.register(tasks);\n return this;\n }\n\n getDownloadUrlForArtifact(componentId: ComponentID, taskId: string, path?: string) {\n return `/api/${componentId}/~aspect/builder/${taskId}/${path ? `${FILE_PATH_PARAM_DELIM}${path}` : ''}`;\n }\n\n static slots = [Slot.withType<BuildTask>(), Slot.withType<BuildTask>(), Slot.withType<BuildTask>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n EnvsAspect,\n WorkspaceAspect,\n ScopeAspect,\n IsolatorAspect,\n LoggerAspect,\n AspectLoaderAspect,\n GraphqlAspect,\n GeneratorAspect,\n ComponentAspect,\n UIAspect,\n GlobalConfigAspect,\n ];\n\n static async provider(\n [cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig]: [\n CLIMain,\n EnvsMain,\n Workspace,\n ScopeMain,\n IsolatorMain,\n LoggerMain,\n AspectLoaderMain,\n GraphqlMain,\n GeneratorMain,\n ComponentMain,\n UiMain,\n GlobalConfigMain\n ],\n config,\n [buildTaskSlot, tagTaskSlot, snapTaskSlot]: [TaskSlot, TaskSlot, TaskSlot]\n ) {\n const artifactFactory = new ArtifactFactory();\n const logger = loggerExt.createLogger(BuilderAspect.id);\n const buildService = new BuilderService(\n isolator,\n logger,\n buildTaskSlot,\n 'getBuildPipe',\n 'build',\n artifactFactory,\n scope,\n globalConfig\n );\n envs.registerService(buildService);\n const tagService = new BuilderService(\n isolator,\n logger,\n tagTaskSlot,\n 'getTagPipe',\n 'tag',\n artifactFactory,\n scope,\n globalConfig\n );\n const snapService = new BuilderService(\n isolator,\n logger,\n snapTaskSlot,\n 'getSnapPipe',\n 'snap',\n artifactFactory,\n scope,\n globalConfig\n );\n const builder = new BuilderMain(\n envs,\n workspace,\n buildService,\n tagService,\n snapService,\n scope,\n isolator,\n aspectLoader,\n component,\n globalConfig,\n buildTaskSlot,\n tagTaskSlot,\n snapTaskSlot,\n logger\n );\n builder.registerBuildTasks([new BundleUiTask(ui, logger)]);\n component.registerRoute([new BuilderRoute(builder, scope, logger)]);\n graphql.register(builderSchema(builder, logger));\n if (generator) generator.registerComponentTemplate([buildTaskTemplate]);\n const commands = [new BuilderCmd(builder, workspace, logger), new ArtifactsCmd(builder, component)];\n cli.register(...commands);\n\n return builder;\n }\n}\n\nBuilderAspect.addRuntime(BuilderMain);\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA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,eAAI,CAACC,QAAQ,CAAY,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,CAAC;AAAA/O,eAAA,CArZxFmB,WAAW,aAuZL6N,kBAAW;AAAAhP,eAAA,CAvZjBmB,WAAW,kBAwZA,CACpB8N,gBAAS,EACTC,kBAAU,EACVC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,4BAAe,EACfC,4BAAe,EACfC,cAAQ,EACRC,kCAAkB,CACnB;AAgFHlF,wBAAa,CAACmF,UAAU,CAAC1O,WAAW,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_artifactFiles","_aspectLoader","_cli","_component","_envs","_graphql","_harmony","_globalConfig","_logger","_aspect","_interopRequireDefault","_scope","_workspace","_isolator","_bootstrap","_toolboxArray","_generator","_ui","_artifact","_artifactFactory","_builder","_builder2","_builder3","_build","_buildTask","_exceptions","_buildPipelineResultList","_artifacts","_buildTask2","_builder4","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","FILE_PATH_PARAM_DELIM","exports","BuilderMain","constructor","envs","workspace","buildService","tagService","snapService","scope","isolator","aspectLoader","componentAspect","globalConfig","buildTaskSlot","tagTaskSlot","snapTaskSlot","logger","storeArtifacts","tasksResults","artifacts","flatMap","storeP","map","artifactMap","Promise","all","toArray","component","artifactList","store","err","ArtifactStorageError","pipelineResultsToBuilderData","components","buildPipelineResults","buildPipelineResultList","BuildPipelineResultList","ComponentMap","as","aspectsData","getDataOfComponent","id","pipelineReport","getPipelineReportOfComponent","getArtifactsDataOfComponent","pipeline","bitVersion","getHarmonyVersion","tagListener","options","isolateOptions","builderOptions","pipeResults","allTasksResults","throwOnError","forceDeploy","disableTagAndSnapPipelines","isSnap","populateArtifactsFrom","buildEnvsExecutionResults","build","emptyRootDir","tasks","AspectAspect","undefined","throwErrorsIfExist","hasErrors","builderOptionsForTagSnap","seedersOnly","previousTasksResults","deployEnvsExecutionResults","runSnapTasks","runTagTasks","builderDataMap","combineBuildDataFrom","validateBuilderDataMap","sanitizePreviewData","harmonyComps","compsBeingTaggedLookup","Set","comp","toString","harmonyCompIdsWithEnvId","envId","getEnvId","isUsingCoreEnv","inWs","lastTaggedEnvHasOnlyOverview","has","isEnvTaggedWithComp","envCompId","ComponentID","fromString","hasId","get","state","aspects","onlyOverview","harmonyCompIdsWithEnvIdMap","Map","compsToDeleteOnlyOverviewPreviewData","envData","previewData","buildData","taskSerializedIds","BuildTaskHelper","serializeId","aspectId","taskId","name","taskName","duplications","findDuplications","Error","join","promises","builderData","populateFrom","find","isEqual","ignoreVersion","idStr","populateFromComp","getHost","version","populateFromBuilderData","getBuilderData","artifact","artifactObj","toObject","a","task","aspectData","p","flattenValue","getArtifactsVinylByAspect","aspectName","getArtifactsByAspect","vinyls","getVinylsAndImportIfMissing","legacyScope","getArtifactsVinylByAspectAndName","getArtifactsByAspectAndName","getArtifactsVinylByAspectAndTaskName","getArtifactsbyAspectAndTaskName","getArtifactsByName","getArtifacts","byAspectNameAndName","byAspectNameAndTaskName","getDataByAspect","ArtifactList","fromArray","BuilderAspect","clonedData","cloneDeep","artifactFiles","files","ArtifactFiles","fromObject","Artifact","assign","fromArtifactObject","extraOptions","ids","c","capsulesBaseDir","getComponentsCapsulesBaseDir","baseIsolateOpts","baseDir","useHash","mergedIsolateOpts","network","isolateComponents","createEnvironment","graphCapsules","getAllComponents","builderServiceOptions","originalSeeders","consoleTitle","buildResult","runOnce","includeSnap","includeTag","listTasks","compEnv","getEnv","buildTasks","getCurrentPipeTasks","tagTasks","snapTasks","registerBuildTasks","register","registerDeployTasks","registerTagTasks","registerSnapTasks","getDownloadUrlForArtifact","componentId","path","provider","cli","loggerExt","graphql","generator","ui","config","artifactFactory","ArtifactFactory","createLogger","BuilderService","registerService","builder","BundleUiTask","registerRoute","BuilderRoute","builderSchema","registerComponentTemplate","buildTaskTemplate","commands","BuilderCmd","ArtifactsCmd","Slot","withType","MainRuntime","CLIAspect","EnvsAspect","WorkspaceAspect","ScopeAspect","IsolatorAspect","LoggerAspect","AspectLoaderAspect","GraphqlAspect","GeneratorAspect","ComponentAspect","UIAspect","GlobalConfigAspect","addRuntime"],"sources":["builder.main.runtime.ts"],"sourcesContent":["import { cloneDeep } from 'lodash';\nimport { ArtifactVinyl } from '@teambit/legacy/dist/consumer/component/sources/artifact';\nimport { ArtifactFiles, ArtifactObject } from '@teambit/legacy/dist/consumer/component/sources/artifact-files';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentMap, IComponent, ComponentAspect, ComponentMain, ComponentID } from '@teambit/component';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport AspectAspect from '@teambit/aspect';\nimport { ScopeAspect, ScopeMain } from '@teambit/scope';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { IsolateComponentsOptions, IsolatorAspect, IsolatorMain } from '@teambit/isolator';\nimport { getHarmonyVersion } from '@teambit/legacy/dist/bootstrap';\nimport { findDuplications } from '@teambit/toolbox.array.duplications-finder';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { UIAspect, UiMain, BundleUiTask } from '@teambit/ui';\nimport { Artifact, ArtifactList, FsArtifact } from './artifact';\nimport { ArtifactFactory } from './artifact/artifact-factory'; // it gets undefined when importing it from './artifact'\nimport { BuilderAspect } from './builder.aspect';\nimport { builderSchema } from './builder.graphql';\nimport { BuilderService, BuilderServiceOptions } from './builder.service';\nimport { BuilderCmd } from './build.cmd';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport { TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { ArtifactStorageError } from './exceptions';\nimport { BuildPipelineResultList, AspectData, PipelineReport } from './build-pipeline-result-list';\nimport { TaskMetadata } from './types';\nimport { ArtifactsCmd } from './artifact/artifacts.cmd';\nimport { buildTaskTemplate } from './templates/build-task';\nimport { BuilderRoute } from './builder.route';\n\nexport type TaskSlot = SlotRegistry<BuildTask[]>;\nexport type OnTagResults = { builderDataMap: ComponentMap<RawBuilderData>; pipeResults: TaskResultsList[] };\nexport type OnTagOpts = {\n disableTagAndSnapPipelines?: boolean;\n throwOnError?: boolean; // on the CI it helps to save the results on failure so this is set to false\n forceDeploy?: boolean; // whether run the deploy-pipeline although the build-pipeline has failed\n populateArtifactsFrom?: ComponentID[]; // helpful for tagging from scope where we want to use the build-artifacts of previous snap.\n isSnap?: boolean;\n};\nexport const FILE_PATH_PARAM_DELIM = '~';\n\n/**\n * builder data format for the bit object store\n */\nexport type RawBuilderData = {\n pipeline: PipelineReport[];\n artifacts?: ArtifactObject[];\n aspectsData: AspectData[];\n bitVersion?: string;\n};\n/**\n * builder data mapped to an ArtifactList instance\n */\nexport type BuilderData = Omit<RawBuilderData, 'artifacts'> & {\n artifacts: ArtifactList<Artifact>;\n};\n\nexport class BuilderMain {\n constructor(\n private envs: EnvsMain,\n private workspace: Workspace,\n private buildService: BuilderService,\n private tagService: BuilderService,\n private snapService: BuilderService,\n private scope: ScopeMain,\n private isolator: IsolatorMain,\n private aspectLoader: AspectLoaderMain,\n private componentAspect: ComponentMain,\n private globalConfig: GlobalConfigMain,\n private buildTaskSlot: TaskSlot,\n private tagTaskSlot: TaskSlot,\n private snapTaskSlot: TaskSlot,\n private logger: Logger\n ) {}\n\n private async storeArtifacts(tasksResults: TaskResults[]) {\n const artifacts = tasksResults.flatMap((t) => (t.artifacts ? [t.artifacts] : []));\n const storeP = artifacts.map(async (artifactMap: ComponentMap<ArtifactList<FsArtifact>>) => {\n return Promise.all(\n artifactMap.toArray().map(async ([component, artifactList]) => {\n try {\n return await artifactList.store(component);\n } catch (err: any) {\n throw new ArtifactStorageError(err, component);\n }\n })\n );\n });\n await Promise.all(storeP);\n }\n\n pipelineResultsToBuilderData(\n components: Component[],\n buildPipelineResults: TaskResults[]\n ): ComponentMap<RawBuilderData> {\n const buildPipelineResultList = new BuildPipelineResultList(buildPipelineResults, components);\n return ComponentMap.as<RawBuilderData>(components, (component) => {\n const aspectsData = buildPipelineResultList.getDataOfComponent(component.id);\n const pipelineReport = buildPipelineResultList.getPipelineReportOfComponent(component.id);\n const artifacts = buildPipelineResultList.getArtifactsDataOfComponent(component.id);\n return { pipeline: pipelineReport, artifacts, aspectsData, bitVersion: getHarmonyVersion(true) };\n });\n }\n\n async tagListener(\n components: Component[],\n options: OnTagOpts = {},\n isolateOptions: IsolateComponentsOptions = {},\n builderOptions: BuilderServiceOptions = {}\n ): Promise<OnTagResults> {\n const pipeResults: TaskResultsList[] = [];\n const allTasksResults: TaskResults[] = [];\n const { throwOnError, forceDeploy, disableTagAndSnapPipelines, isSnap, populateArtifactsFrom } = options;\n if (populateArtifactsFrom) isolateOptions.populateArtifactsFrom = populateArtifactsFrom;\n const buildEnvsExecutionResults = await this.build(\n components,\n { emptyRootDir: true, ...isolateOptions },\n {\n ...builderOptions,\n // even when build is skipped (in case of tag-from-scope), the pre-build/post-build and teambit.harmony/aspect tasks are needed\n tasks: populateArtifactsFrom ? [AspectAspect.id] : undefined,\n }\n );\n if (throwOnError && !forceDeploy) buildEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...buildEnvsExecutionResults.tasksResults);\n pipeResults.push(buildEnvsExecutionResults);\n\n if (forceDeploy || (!disableTagAndSnapPipelines && !buildEnvsExecutionResults?.hasErrors())) {\n const builderOptionsForTagSnap: BuilderServiceOptions = {\n ...builderOptions,\n seedersOnly: isolateOptions.seedersOnly,\n previousTasksResults: buildEnvsExecutionResults?.tasksResults,\n };\n const deployEnvsExecutionResults = isSnap\n ? await this.runSnapTasks(components, builderOptionsForTagSnap)\n : await this.runTagTasks(components, builderOptionsForTagSnap);\n if (throwOnError && !forceDeploy) deployEnvsExecutionResults.throwErrorsIfExist();\n allTasksResults.push(...deployEnvsExecutionResults.tasksResults);\n pipeResults.push(deployEnvsExecutionResults);\n }\n await this.storeArtifacts(allTasksResults);\n const builderDataMap = this.pipelineResultsToBuilderData(components, allTasksResults);\n if (populateArtifactsFrom) await this.combineBuildDataFrom(builderDataMap, populateArtifactsFrom);\n this.validateBuilderDataMap(builderDataMap);\n\n await this.sanitizePreviewData(components);\n\n return { builderDataMap, pipeResults };\n }\n\n /**\n * remove the onlyOverview from the preview data of the component if\n * the env is in the workspace\n * the env is not tagged with the component\n * the last tagged env has onlyOverview undefined in preview data\n *\n * We don't want to do this but have no choice because,\n * when we load components in workspace,\n * we set the onlyOverview to true in the env's preview data\n * which sets the onlyOverview to true in the component's preview data\n * but if you don't tag the env with the component,\n * the onlyOverview will be true in the component's preview data, since its env is in the workspace\n * even though the env it is tagged with doesn't have onlyOverview in its preview data\n * which will result in inconsistent preview data when exported to the scope\n */\n async sanitizePreviewData(harmonyComps: Component[]) {\n const compsBeingTaggedLookup = new Set(harmonyComps.map((comp) => comp.id.toString()));\n\n const harmonyCompIdsWithEnvId = await Promise.all(\n harmonyComps.map(async (comp) => {\n const envId = await this.envs.getEnvId(comp);\n if (this.envs.isUsingCoreEnv(comp)) {\n return [comp.id.toString(), { envId, inWs: false, lastTaggedEnvHasOnlyOverview: false }] as [\n string,\n { envId: string; inWs: boolean; lastTaggedEnvHasOnlyOverview?: boolean; isEnvTaggedWithComp?: boolean }\n ];\n }\n\n // check if the env is tagged with the component\n if (envId && !compsBeingTaggedLookup.has(comp.id.toString())) {\n return [comp.id.toString(), { envId, isEnvTaggedWithComp: false }] as [\n string,\n { envId: string; inWs?: boolean; lastTaggedEnvHasOnlyOverview?: boolean; isEnvTaggedWithComp?: boolean }\n ];\n }\n\n const envCompId = (envId && ComponentID.fromString(envId)) || undefined;\n const inWs = this.workspace && envCompId ? await this.workspace.hasId(envCompId) : false;\n\n const lastTaggedEnvHasOnlyOverview: boolean | undefined =\n envCompId &&\n (await this.scope.get(envCompId, false))?.state.aspects.get('teambit.preview/preview')?.data?.onlyOverview;\n\n return [comp.id.toString(), { envId, inWs, lastTaggedEnvHasOnlyOverview, isEnvTaggedWithComp: true }] as [\n string,\n { envId: string; inWs: boolean; lastTaggedEnvHasOnlyOverview: boolean; isEnvTaggedWithComp?: boolean }\n ];\n })\n );\n\n const harmonyCompIdsWithEnvIdMap = new Map(harmonyCompIdsWithEnvId);\n\n const compsToDeleteOnlyOverviewPreviewData = harmonyComps.filter((comp) => {\n const envData:\n | { envId: string; inWs?: boolean; lastTaggedEnvHasOnlyOverview?: boolean; isEnvTaggedWithComp?: boolean }\n | undefined = harmonyCompIdsWithEnvIdMap.get(comp.id.toString());\n return envData?.inWs && !envData?.lastTaggedEnvHasOnlyOverview && envData?.isEnvTaggedWithComp;\n });\n\n for (const comp of compsToDeleteOnlyOverviewPreviewData) {\n const previewData = comp.state.aspects.get('teambit.preview/preview')?.data;\n // if the env is not tagged with the component remove it from the preview data of the component\n delete previewData?.onlyOverview;\n }\n }\n\n private validateBuilderDataMap(builderDataMap: ComponentMap<RawBuilderData>) {\n builderDataMap.forEach((buildData: RawBuilderData, component) => {\n const taskSerializedIds = buildData.pipeline.map((t) =>\n BuildTaskHelper.serializeId({ aspectId: t.taskId, name: t.taskName })\n );\n const duplications = findDuplications(taskSerializedIds);\n if (duplications.length) {\n throw new Error(\n `build-task-results validation has failed. the following task(s) of \"${component.id.toString()}\" are duplicated: ${duplications.join(\n ', '\n )}`\n );\n }\n });\n }\n\n private async combineBuildDataFrom(\n builderDataMap: ComponentMap<RawBuilderData>,\n populateArtifactsFrom: ComponentID[]\n ) {\n const promises = builderDataMap.map(async (builderData, component) => {\n const populateFrom = populateArtifactsFrom.find((id) => id.isEqual(component.id, { ignoreVersion: true }));\n const idStr = component.id.toString();\n if (!populateFrom) {\n throw new Error(`combineBuildDataFromParent: unable to find where to populate the artifacts from for ${idStr}`);\n }\n const populateFromComp = await this.componentAspect.getHost().get(populateFrom);\n if (!populateFromComp)\n throw new Error(\n `combineBuildDataFromParent, unable to load parent component of ${idStr}. hash: ${populateFrom.version}`\n );\n const populateFromBuilderData = this.getBuilderData(populateFromComp);\n if (!populateFromBuilderData) throw new Error(`parent of ${idStr} was not built yet. unable to continue`);\n populateFromBuilderData.artifacts.forEach((artifact) => {\n const artifactObj = artifact.toObject();\n if (!builderData.artifacts) builderData.artifacts = [];\n if (\n builderData.artifacts.find(\n (a) =>\n a.task.id === artifactObj.task.id && a.task.name === artifactObj.task.name && a.name === artifactObj.name\n )\n ) {\n return;\n }\n builderData.artifacts.push(artifactObj);\n });\n populateFromBuilderData.aspectsData.forEach((aspectData) => {\n if (builderData.aspectsData.find((a) => a.aspectId === aspectData.aspectId)) return;\n builderData.aspectsData.push(aspectData);\n });\n populateFromBuilderData.pipeline.forEach((pipeline) => {\n if (builderData.pipeline.find((p) => p.taskId === pipeline.taskId && p.taskName === pipeline.taskName)) return;\n builderData.pipeline.push(pipeline);\n });\n });\n\n await Promise.all(promises.flattenValue());\n }\n\n // TODO: merge with getArtifactsVinylByExtensionAndName by getting aspect name and name as object with optional props\n async getArtifactsVinylByAspect(component: Component, aspectName: string): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspect(component, aspectName);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsByAspectAndName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n return vinyls;\n }\n\n async getArtifactsVinylByAspectAndTaskName(\n component: Component,\n aspectName: string,\n name: string\n ): Promise<ArtifactVinyl[]> {\n const artifacts = this.getArtifactsbyAspectAndTaskName(component, aspectName, name);\n const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n return vinyls;\n }\n\n getArtifactsByName(component: Component, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(undefined, name);\n return artifacts;\n }\n\n getArtifactsByAspect(component: Component, aspectName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName);\n return artifacts;\n }\n\n getArtifactsByAspectAndName(component: Component, aspectName: string, name: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName, name);\n return artifacts;\n }\n\n getArtifactsbyAspectAndTaskName(component: IComponent, aspectName: string, taskName: string): ArtifactList<Artifact> {\n const artifacts = this.getArtifacts(component).byAspectNameAndTaskName(aspectName, taskName);\n return artifacts;\n }\n\n /**\n * this is the aspect's data that was generated as \"metadata\" of the task component-result during the build process\n * and saved by the builder aspect in the \"aspectsData\" property.\n * (not to be confused with the data saved in the aspect itself, which is saved in the \"data\" property of the aspect).\n */\n getDataByAspect(component: IComponent, aspectName: string): TaskMetadata | undefined {\n const aspectsData = this.getBuilderData(component)?.aspectsData;\n const data = aspectsData?.find((aspectData) => aspectData.aspectId === aspectName);\n return data?.data;\n }\n\n getArtifacts(component: IComponent): ArtifactList<Artifact> {\n const artifacts = this.getBuilderData(component)?.artifacts || ArtifactList.fromArray([]);\n return artifacts;\n }\n\n getBuilderData(component: IComponent): BuilderData | undefined {\n const data = component.get(BuilderAspect.id)?.data;\n if (!data) return undefined;\n const clonedData = cloneDeep(data) as BuilderData;\n let artifactFiles: ArtifactFiles;\n const artifacts = clonedData.artifacts?.map((artifact) => {\n if (!(artifact.files instanceof ArtifactFiles)) {\n artifactFiles = ArtifactFiles.fromObject(artifact.files);\n } else {\n artifactFiles = artifact.files;\n }\n if (artifact instanceof Artifact) {\n return artifact;\n }\n Object.assign(artifact, { files: artifactFiles });\n return Artifact.fromArtifactObject(artifact);\n });\n clonedData.artifacts = ArtifactList.fromArray(artifacts || []);\n return clonedData;\n }\n\n async build(\n components: Component[],\n isolateOptions?: IsolateComponentsOptions,\n builderOptions?: BuilderServiceOptions,\n extraOptions?: { includeTag?: boolean; includeSnap?: boolean }\n ): Promise<TaskResultsList> {\n const ids = components.map((c) => c.id);\n const capsulesBaseDir = this.buildService.getComponentsCapsulesBaseDir();\n const baseIsolateOpts = {\n baseDir: capsulesBaseDir,\n useHash: !capsulesBaseDir,\n };\n const mergedIsolateOpts = {\n ...baseIsolateOpts,\n ...isolateOptions,\n };\n\n const network = await this.isolator.isolateComponents(ids, mergedIsolateOpts, this.scope.legacyScope);\n const envs = await this.envs.createEnvironment(network.graphCapsules.getAllComponents());\n const builderServiceOptions = {\n seedersOnly: isolateOptions?.seedersOnly,\n originalSeeders: ids,\n capsulesBaseDir,\n ...(builderOptions || {}),\n };\n this.logger.consoleTitle(`Total ${components.length} components to build`);\n const buildResult: TaskResultsList = await envs.runOnce(this.buildService, builderServiceOptions);\n\n if (extraOptions?.includeSnap || extraOptions?.includeTag) {\n const builderOptionsForTagSnap: BuilderServiceOptions = {\n ...builderServiceOptions,\n previousTasksResults: buildResult.tasksResults,\n };\n const deployEnvsExecutionResults = extraOptions?.includeSnap\n ? await this.runSnapTasks(components, builderOptionsForTagSnap)\n : await this.runTagTasks(components, builderOptionsForTagSnap);\n buildResult.tasksResults.push(...deployEnvsExecutionResults.tasksResults);\n }\n\n return buildResult;\n }\n\n async runTagTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.tagService, builderOptions);\n\n return buildResult;\n }\n\n async runSnapTasks(components: Component[], builderOptions: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = await this.envs.createEnvironment(components);\n const buildResult = await envs.runOnce(this.snapService, builderOptions);\n\n return buildResult;\n }\n\n listTasks(component: Component) {\n const compEnv = this.envs.getEnv(component);\n const buildTasks = this.buildService.getCurrentPipeTasks(compEnv);\n const tagTasks = this.tagService.getCurrentPipeTasks(compEnv);\n const snapTasks = this.snapService.getCurrentPipeTasks(compEnv);\n return { id: component.id, envId: compEnv.id, buildTasks, tagTasks, snapTasks };\n }\n\n /**\n * register a build task to apply on all component build pipelines.\n * build happens on `bit build` and as part of `bit tag --persist`.\n */\n registerBuildTasks(tasks: BuildTask[]) {\n this.buildTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * @deprecated use registerTagTasks or registerSnapTasks\n */\n registerDeployTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit tag'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerTagTasks(tasks: BuildTask[]) {\n this.tagTaskSlot.register(tasks);\n return this;\n }\n\n /**\n * tag tasks that don't get executed on `bit build`, only on `bit snap'.\n * this pipeline is running once the build-pipeline has completed.\n */\n registerSnapTasks(tasks: BuildTask[]) {\n this.snapTaskSlot.register(tasks);\n return this;\n }\n\n getDownloadUrlForArtifact(componentId: ComponentID, taskId: string, path?: string) {\n return `/api/${componentId}/~aspect/builder/${taskId}/${path ? `${FILE_PATH_PARAM_DELIM}${path}` : ''}`;\n }\n\n static slots = [Slot.withType<BuildTask>(), Slot.withType<BuildTask>(), Slot.withType<BuildTask>()];\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n EnvsAspect,\n WorkspaceAspect,\n ScopeAspect,\n IsolatorAspect,\n LoggerAspect,\n AspectLoaderAspect,\n GraphqlAspect,\n GeneratorAspect,\n ComponentAspect,\n UIAspect,\n GlobalConfigAspect,\n ];\n\n static async provider(\n [cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component, ui, globalConfig]: [\n CLIMain,\n EnvsMain,\n Workspace,\n ScopeMain,\n IsolatorMain,\n LoggerMain,\n AspectLoaderMain,\n GraphqlMain,\n GeneratorMain,\n ComponentMain,\n UiMain,\n GlobalConfigMain\n ],\n config,\n [buildTaskSlot, tagTaskSlot, snapTaskSlot]: [TaskSlot, TaskSlot, TaskSlot]\n ) {\n const artifactFactory = new ArtifactFactory();\n const logger = loggerExt.createLogger(BuilderAspect.id);\n const buildService = new BuilderService(\n isolator,\n logger,\n buildTaskSlot,\n 'getBuildPipe',\n 'build',\n artifactFactory,\n scope,\n globalConfig\n );\n envs.registerService(buildService);\n const tagService = new BuilderService(\n isolator,\n logger,\n tagTaskSlot,\n 'getTagPipe',\n 'tag',\n artifactFactory,\n scope,\n globalConfig\n );\n const snapService = new BuilderService(\n isolator,\n logger,\n snapTaskSlot,\n 'getSnapPipe',\n 'snap',\n artifactFactory,\n scope,\n globalConfig\n );\n const builder = new BuilderMain(\n envs,\n workspace,\n buildService,\n tagService,\n snapService,\n scope,\n isolator,\n aspectLoader,\n component,\n globalConfig,\n buildTaskSlot,\n tagTaskSlot,\n snapTaskSlot,\n logger\n );\n builder.registerBuildTasks([new BundleUiTask(ui, logger)]);\n component.registerRoute([new BuilderRoute(builder, scope, logger)]);\n graphql.register(builderSchema(builder, logger));\n if (generator) generator.registerComponentTemplate([buildTaskTemplate]);\n const commands = [new BuilderCmd(builder, workspace, logger), new ArtifactsCmd(builder, component)];\n cli.register(...commands);\n\n return builder;\n }\n}\n\nBuilderAspect.addRuntime(BuilderMain);\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAA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M,CAAC,CAAC,CAAC;IACnEyL,OAAO,CAACV,QAAQ,CAAC,IAAAuB,yBAAa,EAACJ,OAAO,EAAElM,MAAM,CAAC,CAAC;IAChD,IAAI0L,SAAS,EAAEA,SAAS,CAACa,yBAAyB,CAAC,CAACC,+BAAiB,CAAC,CAAC;IACvE,MAAMC,QAAQ,GAAG,CAAC,KAAIC,mBAAU,EAACR,OAAO,EAAE9M,SAAS,EAAEY,MAAM,CAAC,EAAE,KAAI2M,yBAAY,EAACT,OAAO,EAAEvL,SAAS,CAAC,CAAC;IACnG4K,GAAG,CAACR,QAAQ,CAAC,GAAG0B,QAAQ,CAAC;IAEzB,OAAOP,OAAO;EAChB;AACF;AAAClN,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAAAnB,eAAA,CAnfYmB,WAAW,WAqZP,CAAC2N,eAAI,CAACC,QAAQ,CAAY,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,CAAC;AAAA/O,eAAA,CArZxFmB,WAAW,aAuZL6N,kBAAW;AAAAhP,eAAA,CAvZjBmB,WAAW,kBAwZA,CACpB8N,gBAAS,EACTC,kBAAU,EACVC,4BAAe,EACfC,oBAAW,EACXC,0BAAc,EACdC,sBAAY,EACZC,kCAAkB,EAClBC,wBAAa,EACbC,4BAAe,EACfC,4BAAe,EACfC,cAAQ,EACRC,kCAAkB,CACnB;AAgFHlF,wBAAa,CAACmF,UAAU,CAAC1O,WAAW,CAAC","ignoreList":[]}
|
package/dist/builder.route.js
CHANGED
|
@@ -20,7 +20,7 @@ function _mime() {
|
|
|
20
20
|
}
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
24
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
25
|
const routePath = exports.routePath = `builder`;
|
|
26
26
|
const defaultExtension = exports.defaultExtension = '.tgz';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_archiver","data","_interopRequireDefault","require","_mime","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","
|
|
1
|
+
{"version":3,"names":["_archiver","data","_interopRequireDefault","require","_mime","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","routePath","exports","defaultExtension","BuilderRoute","constructor","builder","scope","logger","req","res","component","params","aspectIdStr","filePath","split","aspectId","replace","artifacts","getArtifactsByAspect","getArtifacts","status","jsonp","error","id","extensionsWithArtifacts","Promise","all","map","artifact","files","getVinylsAndImportIfMissing","legacyScope","extensionId","task","filter","file","path","artifactFilesCount","reduce","accum","next","length","extensionWithArtifact","find","fileName","fileContent","contents","fileExt","extname","contentType","mime","getType","set","send","archive","archiver","gzip","on","warn","message","err","forEach","extensionWithArtifacts","append","name","pipe","finalize","attachment","toString"],"sources":["builder.route.ts"],"sourcesContent":["import { Request, Response, Route } from '@teambit/express';\nimport { Component } from '@teambit/component';\nimport archiver from 'archiver';\nimport { Logger } from '@teambit/logger';\nimport { ScopeMain } from '@teambit/scope';\nimport mime from 'mime';\nimport { BuilderMain } from './builder.main.runtime';\n\nexport const routePath = `builder`;\n\nexport type BuilderUrlParams = {\n aspectId?: string;\n filePath?: string;\n};\nexport const defaultExtension = '.tgz';\nexport class BuilderRoute implements Route {\n constructor(private builder: BuilderMain, private scope: ScopeMain, private logger: Logger) {}\n route = `/${routePath}/*`;\n method = 'get';\n\n middlewares = [\n async (req: Request<BuilderUrlParams>, res: Response) => {\n // @ts-ignore TODO: @guy please fix.\n const component = req.component as Component;\n const { params } = req;\n const [aspectIdStr, filePath] = params[1].split('~');\n // remove trailing slash\n const aspectId = aspectIdStr.replace(/\\/$/, '');\n const artifacts = aspectId\n ? this.builder.getArtifactsByAspect(component, aspectId)\n : this.builder.getArtifacts(component);\n if (!artifacts)\n return res\n .status(404)\n .jsonp({ error: `no artifacts found for component ${component.id} by aspect ${aspectId}` });\n const extensionsWithArtifacts = await Promise.all(\n artifacts.map(async (artifact) => {\n const files = await artifact.files.getVinylsAndImportIfMissing(component.id, this.scope.legacyScope);\n if (!filePath) return { extensionId: artifact.task.aspectId, files };\n return { extensionId: artifact.task.aspectId, files: files.filter((file) => file.path === filePath) };\n })\n );\n\n const artifactFilesCount = extensionsWithArtifacts.reduce((accum, next) => accum + next.files.length, 0);\n\n if (artifactFilesCount === 0)\n return res\n .status(404)\n .jsonp({ error: `no artifacts found for component ${component.id} by aspect ${aspectId}` });\n\n if (artifactFilesCount === 1) {\n const extensionWithArtifact = extensionsWithArtifacts.find((e) => e.files.length > 0);\n const fileName = `${extensionWithArtifact?.extensionId}_${extensionWithArtifact?.files[0].path}`;\n const fileContent = extensionWithArtifact?.files[0].contents;\n const fileExt = extensionWithArtifact?.files[0].extname || defaultExtension;\n const contentType = mime.getType(fileExt);\n res.set('Content-disposition', `attachment; filename=${fileName}`);\n if (contentType) res.set('Content-Type', contentType);\n return res.send(fileContent);\n }\n\n /**\n * if more than 1 file requested, zip them before sending\n */\n const archive = archiver('tar', { gzip: true });\n\n archive.on('warning', (warn) => {\n this.logger.warn(warn.message);\n });\n\n archive.on('error', (err) => {\n this.logger.error(err.message);\n });\n\n extensionsWithArtifacts.forEach((extensionWithArtifacts) => {\n extensionWithArtifacts.files.forEach((artifact) => {\n archive.append(artifact.contents, { name: `${extensionWithArtifacts.extensionId}_${artifact.path}` });\n });\n });\n\n try {\n archive.pipe(res);\n /**\n * promise that is returned from the await zip.finalize(); is resolved before the archive is actually finalized\n * resolving it results in setting the headers before the stream is finished\n */\n // eslint-disable-next-line no-void\n void archive.finalize();\n return res.attachment(`${aspectId.replace('/', '_')}.tar`);\n } catch (e: any) {\n return res.send({ error: e.toString() });\n }\n },\n ];\n}\n"],"mappings":";;;;;;AAEA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwB,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,G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ACQ;QACA,KAAK6C,OAAO,CAACY,QAAQ,CAAC,CAAC;QACvB,OAAOzD,GAAG,CAAC0D,UAAU,CAAE,GAAEpD,QAAQ,CAACC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAE,MAAK,CAAC;MAC5D,CAAC,CAAC,OAAOvB,CAAM,EAAE;QACf,OAAOgB,GAAG,CAAC4C,IAAI,CAAC;UAAE/B,KAAK,EAAE7B,CAAC,CAAC2E,QAAQ,CAAC;QAAE,CAAC,CAAC;MAC1C;IACF,CAAC,CACF;EA7E4F;AA8E/F;AAACnE,OAAA,CAAAE,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/dist/builder.service.js
CHANGED
|
@@ -55,7 +55,7 @@ function _buildPipelineOrder() {
|
|
|
55
55
|
}
|
|
56
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
57
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
58
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
58
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
59
59
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
60
60
|
const pipeNames = {
|
|
61
61
|
getBuildPipe: 'build',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","data","require","_chalk","_interopRequireDefault","_lodash","_pMapSeries","_buildPipe","_buildTask","_buildPipelineOrder","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","pipeNames","getBuildPipe","getTagPipe","getSnapPipe","BuilderService","constructor","isolator","logger","taskSlot","pipeNameOnEnv","displayPipeName","artifactFactory","scope","globalConfig","runOnce","envsExecutionContext","options","envs","map","executionContext","envDefinition","tasksQueue","calculatePipelineOrder","tasks","skipTests","skipTasks","validate","info","toString","console","title","length","longProcessLogger","createLongProcessLogger","undefined","envsBuildContext","capsulesBaseDir","getComponentsCapsulesBaseDir","baseDir","useHash","isolateOptions","getExistingAsIs","seedersOnly","pMapSeries","componentIds","components","component","id","originalSeeders","originalSeedersOfThisEnv","filter","compId","find","seeder","isEqual","capsuleNetwork","isolateComponents","_originalSeeders","msg","extraDetails","seedersCapsules","graphCapsules","chalk","dim","buildContext","assign","previousTasksResults","pipeName","dev","laneId","legacyScope","getCurrentLaneId","envIdsWithoutVersion","env","split","buildPipe","BuildPipe","exitOnFirstFailedTask","showEnvNameInOutput","showEnvVersionInOutput","uniq","buildResults","execute","end","hasErrors","getSync","CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR","render","descriptor","getDescriptor","transform","envContext","build","pipeline","compute","tag","snap","getTasksNamesByPipeFunc","pipeFuncName","task","BuildTaskHelper","serializeId","getCurrentPipeTasks","exports"],"sources":["builder.service.ts"],"sourcesContent":["import { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';\nimport { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport chalk from 'chalk';\nimport { uniq } from 'lodash';\nimport { ScopeMain } from '@teambit/scope';\nimport pMapSeries from 'p-map-series';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Logger } from '@teambit/logger';\nimport { IsolatorMain } from '@teambit/isolator';\nimport { Component, ComponentID } from '@teambit/component';\nimport { BuildPipe, TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskSlot } from './builder.main.runtime';\nimport { BuildContext, BuildTask, BuildTaskHelper } from './build-task';\nimport { ArtifactFactory } from './artifact';\nimport { calculatePipelineOrder } from './build-pipeline-order';\n\nexport type BuildServiceResults = {\n id: string;\n buildResults: TaskResultsList;\n components: Component[];\n errors?: [];\n};\n\nexport type BuilderServiceOptions = {\n seedersOnly?: boolean;\n originalSeeders?: ComponentID[];\n tasks?: string[];\n skipTests?: boolean;\n skipTasks?: string[];\n previousTasksResults?: TaskResults[];\n dev?: boolean;\n exitOnFirstFailedTask?: boolean;\n capsulesBaseDir?: string;\n};\n\ntype BuilderTransformationMap = ServiceTransformationMap & {\n getBuildPipe: () => BuildTask[];\n getTagPipe: () => BuildTask[];\n getSnapPipe: () => BuildTask[];\n};\n\nexport type EnvsBuildContext = { [envId: string]: BuildContext };\n\nconst pipeNames = {\n getBuildPipe: 'build',\n getTagPipe: 'tag',\n getSnapPipe: 'snap',\n};\n\nexport type PipeName = 'build' | 'tag' | 'snap';\n\nexport type BuilderDescriptor = Array<{ pipeName: PipeName; tasks: string[] }>;\n\nexport type PipeFunctionNames = keyof typeof pipeNames;\nexport class BuilderService implements EnvService<BuildServiceResults, string> {\n name = 'builder';\n\n constructor(\n /**\n * isolator extension.\n */\n private isolator: IsolatorMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * task slot (e.g tasks registered by other extensions.).\n */\n private taskSlot: TaskSlot,\n\n /**\n * a method with such name should be implemented on the env in order to run the pipe tasks.\n */\n private pipeNameOnEnv: PipeFunctionNames,\n\n /**\n * pipe name to display on the console during the execution\n */\n private displayPipeName: PipeName,\n private artifactFactory: ArtifactFactory,\n private scope: ScopeMain,\n private globalConfig: GlobalConfigMain\n ) {}\n\n /**\n * runs all tasks for all envs\n */\n async runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = envsExecutionContext.map((executionContext) => executionContext.envDefinition);\n const tasksQueue = calculatePipelineOrder(\n this.taskSlot,\n envs,\n this.pipeNameOnEnv,\n options.tasks,\n options.skipTests,\n options.skipTasks\n );\n tasksQueue.validate();\n this.logger.info(`going to run tasks in the following order:\\n${tasksQueue.toString()}`);\n this.logger.console('\\n'); // this is to make is clear separation between the various pipelines (build/snap/tag)\n const title = `Running ${this.displayPipeName} pipeline using ${envs.length} environment(s), total ${tasksQueue.length} tasks`;\n const longProcessLogger = this.logger.createLongProcessLogger(title, undefined, 'title');\n const envsBuildContext: EnvsBuildContext = {};\n const capsulesBaseDir = this.getComponentsCapsulesBaseDir();\n\n const baseDir = options.capsulesBaseDir || capsulesBaseDir;\n const useHash = !baseDir;\n const isolateOptions = {\n baseDir,\n useHash,\n getExistingAsIs: true,\n seedersOnly: options.seedersOnly,\n };\n\n await pMapSeries(envsExecutionContext, async (executionContext) => {\n const componentIds = executionContext.components.map((component) => component.id);\n const { originalSeeders } = options;\n const originalSeedersOfThisEnv = componentIds.filter((compId) =>\n originalSeeders ? originalSeeders.find((seeder) => compId.isEqual(seeder)) : true\n );\n const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOptions);\n capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;\n const msg = `building ${originalSeedersOfThisEnv.length} components of env \"${executionContext.id}\"`;\n const extraDetails = `original seeders of this env: ${originalSeedersOfThisEnv.length}, graph of this env: ${capsuleNetwork.seedersCapsules.length}, graph total (include other envs): ${capsuleNetwork.graphCapsules.length}`;\n this.logger.console(`${msg}. ${chalk.dim(extraDetails)}`);\n const buildContext = Object.assign(executionContext, {\n capsuleNetwork,\n previousTasksResults: [],\n pipeName: this.displayPipeName,\n dev: options.dev,\n laneId: this.scope.legacyScope.getCurrentLaneId(),\n });\n envsBuildContext[executionContext.id] = buildContext;\n });\n const envIdsWithoutVersion = envs.map((env) => env.id.split('@')[0]);\n const buildPipe = new BuildPipe(\n tasksQueue,\n envsBuildContext,\n this.logger,\n this.artifactFactory,\n options.previousTasksResults,\n {\n exitOnFirstFailedTask: options.exitOnFirstFailedTask,\n showEnvNameInOutput: envs.length > 1,\n showEnvVersionInOutput: envIdsWithoutVersion.length > uniq(envIdsWithoutVersion).length,\n }\n );\n const buildResults = await buildPipe.execute();\n longProcessLogger.end(buildResults.hasErrors() ? 'error' : 'success');\n\n return buildResults;\n }\n\n getComponentsCapsulesBaseDir(): string | undefined {\n return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);\n }\n\n render() {\n const descriptor = this.getDescriptor();\n return descriptor;\n }\n\n transform(env: Env, envContext: EnvContext): BuilderTransformationMap | undefined {\n if (!env?.build) return undefined;\n return {\n getBuildPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.build();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getTagPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.tag();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getSnapPipe: () => {\n const pipeline = env.snap();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n };\n }\n\n getDescriptor() {\n return 'run `bit build --list-tasks <component-id>` to see the tasks list for the pipelines: build, tag and snap';\n }\n\n private getTasksNamesByPipeFunc(env: EnvDefinition, pipeFuncName: PipeFunctionNames): string[] {\n const tasksQueue = calculatePipelineOrder(this.taskSlot, [env], pipeFuncName).map(({ task }) =>\n BuildTaskHelper.serializeId(task)\n );\n return tasksQueue;\n }\n\n getCurrentPipeTasks(env: EnvDefinition) {\n return this.getTasksNamesByPipeFunc(env, this.pipeNameOnEnv);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,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C;QAC3B,IAAI,CAACH,QAAQ,IAAI,CAACA,QAAQ,CAACC,OAAO,EAAE,OAAO,EAAE;QAC7C,OAAOD,QAAQ,EAAEC,OAAO,CAACH,UAAU,CAAC;MACtC;IACF,CAAC;EACH;EAEAF,aAAaA,CAAA,EAAG;IACd,OAAO,0GAA0G;EACnH;EAEQQ,uBAAuBA,CAACxB,GAAkB,EAAEyB,YAA+B,EAAY;IAC7F,MAAM7E,UAAU,GAAG,IAAAC,4CAAsB,EAAC,IAAI,CAACd,QAAQ,EAAE,CAACiE,GAAG,CAAC,EAAEyB,YAAY,CAAC,CAAChF,GAAG,CAAC,CAAC;MAAEiF;IAAK,CAAC,KACzFC,4BAAe,CAACC,WAAW,CAACF,IAAI,CAClC,CAAC;IACD,OAAO9E,UAAU;EACnB;EAEAiF,mBAAmBA,CAAC7B,GAAkB,EAAE;IACtC,OAAO,IAAI,CAACwB,uBAAuB,CAACxB,GAAG,EAAE,IAAI,CAAChE,aAAa,CAAC;EAC9D;AACF;AAAC8F,OAAA,CAAAnG,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_constants","data","require","_chalk","_interopRequireDefault","_lodash","_pMapSeries","_buildPipe","_buildTask","_buildPipelineOrder","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","pipeNames","getBuildPipe","getTagPipe","getSnapPipe","BuilderService","constructor","isolator","logger","taskSlot","pipeNameOnEnv","displayPipeName","artifactFactory","scope","globalConfig","runOnce","envsExecutionContext","options","envs","map","executionContext","envDefinition","tasksQueue","calculatePipelineOrder","tasks","skipTests","skipTasks","validate","info","toString","console","title","length","longProcessLogger","createLongProcessLogger","undefined","envsBuildContext","capsulesBaseDir","getComponentsCapsulesBaseDir","baseDir","useHash","isolateOptions","getExistingAsIs","seedersOnly","pMapSeries","componentIds","components","component","id","originalSeeders","originalSeedersOfThisEnv","filter","compId","find","seeder","isEqual","capsuleNetwork","isolateComponents","_originalSeeders","msg","extraDetails","seedersCapsules","graphCapsules","chalk","dim","buildContext","assign","previousTasksResults","pipeName","dev","laneId","legacyScope","getCurrentLaneId","envIdsWithoutVersion","env","split","buildPipe","BuildPipe","exitOnFirstFailedTask","showEnvNameInOutput","showEnvVersionInOutput","uniq","buildResults","execute","end","hasErrors","getSync","CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR","render","descriptor","getDescriptor","transform","envContext","build","pipeline","compute","tag","snap","getTasksNamesByPipeFunc","pipeFuncName","task","BuildTaskHelper","serializeId","getCurrentPipeTasks","exports"],"sources":["builder.service.ts"],"sourcesContent":["import { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';\nimport { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport chalk from 'chalk';\nimport { uniq } from 'lodash';\nimport { ScopeMain } from '@teambit/scope';\nimport pMapSeries from 'p-map-series';\nimport { GlobalConfigMain } from '@teambit/global-config';\nimport { Logger } from '@teambit/logger';\nimport { IsolatorMain } from '@teambit/isolator';\nimport { Component, ComponentID } from '@teambit/component';\nimport { BuildPipe, TaskResults } from './build-pipe';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskSlot } from './builder.main.runtime';\nimport { BuildContext, BuildTask, BuildTaskHelper } from './build-task';\nimport { ArtifactFactory } from './artifact';\nimport { calculatePipelineOrder } from './build-pipeline-order';\n\nexport type BuildServiceResults = {\n id: string;\n buildResults: TaskResultsList;\n components: Component[];\n errors?: [];\n};\n\nexport type BuilderServiceOptions = {\n seedersOnly?: boolean;\n originalSeeders?: ComponentID[];\n tasks?: string[];\n skipTests?: boolean;\n skipTasks?: string[];\n previousTasksResults?: TaskResults[];\n dev?: boolean;\n exitOnFirstFailedTask?: boolean;\n capsulesBaseDir?: string;\n};\n\ntype BuilderTransformationMap = ServiceTransformationMap & {\n getBuildPipe: () => BuildTask[];\n getTagPipe: () => BuildTask[];\n getSnapPipe: () => BuildTask[];\n};\n\nexport type EnvsBuildContext = { [envId: string]: BuildContext };\n\nconst pipeNames = {\n getBuildPipe: 'build',\n getTagPipe: 'tag',\n getSnapPipe: 'snap',\n};\n\nexport type PipeName = 'build' | 'tag' | 'snap';\n\nexport type BuilderDescriptor = Array<{ pipeName: PipeName; tasks: string[] }>;\n\nexport type PipeFunctionNames = keyof typeof pipeNames;\nexport class BuilderService implements EnvService<BuildServiceResults, string> {\n name = 'builder';\n\n constructor(\n /**\n * isolator extension.\n */\n private isolator: IsolatorMain,\n\n /**\n * logger extension.\n */\n private logger: Logger,\n\n /**\n * task slot (e.g tasks registered by other extensions.).\n */\n private taskSlot: TaskSlot,\n\n /**\n * a method with such name should be implemented on the env in order to run the pipe tasks.\n */\n private pipeNameOnEnv: PipeFunctionNames,\n\n /**\n * pipe name to display on the console during the execution\n */\n private displayPipeName: PipeName,\n private artifactFactory: ArtifactFactory,\n private scope: ScopeMain,\n private globalConfig: GlobalConfigMain\n ) {}\n\n /**\n * runs all tasks for all envs\n */\n async runOnce(envsExecutionContext: ExecutionContext[], options: BuilderServiceOptions): Promise<TaskResultsList> {\n const envs = envsExecutionContext.map((executionContext) => executionContext.envDefinition);\n const tasksQueue = calculatePipelineOrder(\n this.taskSlot,\n envs,\n this.pipeNameOnEnv,\n options.tasks,\n options.skipTests,\n options.skipTasks\n );\n tasksQueue.validate();\n this.logger.info(`going to run tasks in the following order:\\n${tasksQueue.toString()}`);\n this.logger.console('\\n'); // this is to make is clear separation between the various pipelines (build/snap/tag)\n const title = `Running ${this.displayPipeName} pipeline using ${envs.length} environment(s), total ${tasksQueue.length} tasks`;\n const longProcessLogger = this.logger.createLongProcessLogger(title, undefined, 'title');\n const envsBuildContext: EnvsBuildContext = {};\n const capsulesBaseDir = this.getComponentsCapsulesBaseDir();\n\n const baseDir = options.capsulesBaseDir || capsulesBaseDir;\n const useHash = !baseDir;\n const isolateOptions = {\n baseDir,\n useHash,\n getExistingAsIs: true,\n seedersOnly: options.seedersOnly,\n };\n\n await pMapSeries(envsExecutionContext, async (executionContext) => {\n const componentIds = executionContext.components.map((component) => component.id);\n const { originalSeeders } = options;\n const originalSeedersOfThisEnv = componentIds.filter((compId) =>\n originalSeeders ? originalSeeders.find((seeder) => compId.isEqual(seeder)) : true\n );\n const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOptions);\n capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;\n const msg = `building ${originalSeedersOfThisEnv.length} components of env \"${executionContext.id}\"`;\n const extraDetails = `original seeders of this env: ${originalSeedersOfThisEnv.length}, graph of this env: ${capsuleNetwork.seedersCapsules.length}, graph total (include other envs): ${capsuleNetwork.graphCapsules.length}`;\n this.logger.console(`${msg}. ${chalk.dim(extraDetails)}`);\n const buildContext = Object.assign(executionContext, {\n capsuleNetwork,\n previousTasksResults: [],\n pipeName: this.displayPipeName,\n dev: options.dev,\n laneId: this.scope.legacyScope.getCurrentLaneId(),\n });\n envsBuildContext[executionContext.id] = buildContext;\n });\n const envIdsWithoutVersion = envs.map((env) => env.id.split('@')[0]);\n const buildPipe = new BuildPipe(\n tasksQueue,\n envsBuildContext,\n this.logger,\n this.artifactFactory,\n options.previousTasksResults,\n {\n exitOnFirstFailedTask: options.exitOnFirstFailedTask,\n showEnvNameInOutput: envs.length > 1,\n showEnvVersionInOutput: envIdsWithoutVersion.length > uniq(envIdsWithoutVersion).length,\n }\n );\n const buildResults = await buildPipe.execute();\n longProcessLogger.end(buildResults.hasErrors() ? 'error' : 'success');\n\n return buildResults;\n }\n\n getComponentsCapsulesBaseDir(): string | undefined {\n return this.globalConfig.getSync(CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR);\n }\n\n render() {\n const descriptor = this.getDescriptor();\n return descriptor;\n }\n\n transform(env: Env, envContext: EnvContext): BuilderTransformationMap | undefined {\n if (!env?.build) return undefined;\n return {\n getBuildPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.build();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getTagPipe: () => {\n // TODO: refactor after defining for an env property\n const pipeline = env.tag();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n getSnapPipe: () => {\n const pipeline = env.snap();\n if (!pipeline || !pipeline.compute) return [];\n return pipeline?.compute(envContext);\n },\n };\n }\n\n getDescriptor() {\n return 'run `bit build --list-tasks <component-id>` to see the tasks list for the pipelines: build, tag and snap';\n }\n\n private getTasksNamesByPipeFunc(env: EnvDefinition, pipeFuncName: PipeFunctionNames): string[] {\n const tasksQueue = calculatePipelineOrder(this.taskSlot, [env], pipeFuncName).map(({ task }) =>\n BuildTaskHelper.serializeId(task)\n );\n return tasksQueue;\n }\n\n getCurrentPipeTasks(env: EnvDefinition) {\n return this.getTasksNamesByPipeFunc(env, this.pipeNameOnEnv);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,OAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,MAAA,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;AAEA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;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AAC,CAAC;MAAEiF;IAAK,CAAC,KACzFC,4BAAe,CAACC,WAAW,CAACF,IAAI,CAClC,CAAC;IACD,OAAO9E,UAAU;EACnB;EAEAiF,mBAAmBA,CAAC7B,GAAkB,EAAE;IACtC,OAAO,IAAI,CAACwB,uBAAuB,CAACxB,GAAG,EAAE,IAAI,CAAChE,aAAa,CAAC;EAC9D;AACF;AAAC8F,OAAA,CAAAnG,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.210/dist/builder.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.210/dist/builder.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DefaultResolver = void 0;
|
|
7
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
class DefaultResolver {
|
|
11
11
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/builder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.210",
|
|
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.210"
|
|
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.
|
|
30
|
-
"@teambit/envs": "1.0.
|
|
29
|
+
"@teambit/component": "1.0.210",
|
|
30
|
+
"@teambit/envs": "1.0.210",
|
|
31
31
|
"@teambit/logger": "0.0.951",
|
|
32
32
|
"@teambit/toolbox.string.capitalize": "0.0.496",
|
|
33
|
-
"@teambit/tester": "1.0.
|
|
34
|
-
"@teambit/isolator": "1.0.
|
|
33
|
+
"@teambit/tester": "1.0.210",
|
|
34
|
+
"@teambit/isolator": "1.0.210",
|
|
35
35
|
"@teambit/cli": "0.0.858",
|
|
36
|
-
"@teambit/workspace": "1.0.
|
|
37
|
-
"@teambit/aspect-loader": "1.0.
|
|
38
|
-
"@teambit/aspect": "1.0.
|
|
39
|
-
"@teambit/generator": "1.0.
|
|
36
|
+
"@teambit/workspace": "1.0.210",
|
|
37
|
+
"@teambit/aspect-loader": "1.0.210",
|
|
38
|
+
"@teambit/aspect": "1.0.210",
|
|
39
|
+
"@teambit/generator": "1.0.211",
|
|
40
40
|
"@teambit/global-config": "0.0.861",
|
|
41
|
-
"@teambit/graphql": "1.0.
|
|
42
|
-
"@teambit/scope": "1.0.
|
|
41
|
+
"@teambit/graphql": "1.0.210",
|
|
42
|
+
"@teambit/scope": "1.0.210",
|
|
43
43
|
"@teambit/toolbox.array.duplications-finder": "0.0.1",
|
|
44
|
-
"@teambit/ui": "1.0.
|
|
44
|
+
"@teambit/ui": "1.0.210",
|
|
45
45
|
"@teambit/express": "0.0.957"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|