@teambit/builder 0.0.1158 → 0.0.1159
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/dist/artifact/artifact-extractor.js +2 -5
- package/dist/artifact/artifact-extractor.js.map +1 -1
- package/dist/artifact/artifact-factory.js +1 -2
- package/dist/artifact/artifact-factory.js.map +1 -1
- package/dist/artifact/artifact-list.js +1 -5
- package/dist/artifact/artifact-list.js.map +1 -1
- package/dist/artifact/artifact.js +0 -1
- package/dist/artifact/artifact.js.map +1 -1
- package/dist/artifact/artifacts.cmd.js +12 -18
- package/dist/artifact/artifacts.cmd.js.map +1 -1
- package/dist/build-pipe.js +8 -16
- package/dist/build-pipe.js.map +1 -1
- package/dist/build-pipeline-order.js +1 -4
- package/dist/build-pipeline-order.js.map +1 -1
- package/dist/build-pipeline-result-list.js +5 -14
- package/dist/build-pipeline-result-list.js.map +1 -1
- package/dist/build-task.js +0 -1
- package/dist/build-task.js.map +1 -1
- package/dist/build.cmd.js +12 -20
- package/dist/build.cmd.js.map +1 -1
- package/dist/builder.composition.js +1 -1
- package/dist/builder.composition.js.map +1 -1
- package/dist/builder.graphql.js +5 -12
- package/dist/builder.graphql.js.map +1 -1
- package/dist/builder.main.runtime.js +8 -16
- package/dist/builder.main.runtime.js.map +1 -1
- package/dist/builder.route.js +7 -15
- package/dist/builder.route.js.map +1 -1
- package/dist/builder.service.js +5 -11
- package/dist/builder.service.js.map +1 -1
- package/dist/{preview-1694575035715.js → preview-1694624356552.js} +2 -2
- package/dist/storage/default-resolver.js +4 -10
- package/dist/storage/default-resolver.js.map +1 -1
- package/dist/task-results-list.js +1 -1
- package/dist/task-results-list.js.map +1 -1
- package/package.json +20 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graph","data","require","_tester","_interopRequireDefault","_buildTask","_tasksQueue","calculatePipelineOrder","taskSlot","envs","pipeNameOnEnv","tasks","skipTests","graphs","locations","forEach","location","push","graph","Graph","pipelineEnvs","envDefinition","pipeline","getPipelineForEnv","env","flattenedPipeline","map","pipelineEnv","flat","task","addDependenciesToGraph","dataPerLocation","pipelineEnvsPerLocation","filter","tasksQueue","TasksQueue","addTasksToGraph","length","includes","name","aspectId","TesterAspect","id","find","d","sorted","toposort","taskNode","BuildTaskHelper","deserializeId","attr","taskIndex","findIndex","pipelineTask","splice","dependencies","taskId","serializeId","dependency","deserializeIdAllowEmptyName","dependencyTasks","Error","dependencyTask","getLocation","graphLocation","g","dependencyId","setNode","Node","setEdge","Edge","taskLocation","dependencyLocation","isDependencyAhead","isDependencyEqual","buildTasks","slotsTasks","values","tasksAtStart","tasksAtEnd","mergedTasks"],"sources":["build-pipeline-order.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport TesterAspect from '@teambit/tester';\nimport { EnvDefinition, Environment } from '@teambit/envs';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport type { TaskSlot } from './builder.main.runtime';\nimport { TasksQueue } from './tasks-queue';\nimport { PipeFunctionNames } from './builder.service';\n\ntype TaskDependenciesGraph = Graph<string, string>;\ntype Location = 'start' | 'middle' | 'end';\ntype TasksLocationGraph = { location: Location; graph: TaskDependenciesGraph };\ntype PipelineEnv = { env: EnvDefinition; pipeline: BuildTask[] };\ntype DataPerLocation = { location: Location; graph: TaskDependenciesGraph; pipelineEnvs: PipelineEnv[] };\n\n/**\n * there are two ways how to add tasks to build pipeline.\n * 1. `getBuildPipe()` method of the env.\n * 2. registering to the `builder.registerBuildTask()`.\n *\n * in the option #1, it's possible to determine the order. e.g. `getBuildPipe() { return [taskA, taskB, taskC]; }`\n * in the option #2, the register happens once the extension is loaded, so there is no way to put\n * one task before/after another task.\n *\n * To be able to determine the order, you can do the following\n * 1. \"task.location\", it has two options \"start\" and \"end\". the rest are \"middle\".\n * 2. \"task.dependencies\", the dependencies must be completed for all envs before this task starts.\n * the dependencies are applicable inside a location and not across locations. see getLocation()\n * or/and continue reading for more info about this.\n *\n * to determine the final order of the tasks, the following is done:\n * 1. split all tasks to three groups: start, middle and end.\n * 2. for each group define a dependencies graph for the tasks with \"dependencies\" prop and the pipeline.\n * 3. start with the first group \"start\", toposort the dependencies graph and push the found tasks\n * to a queue. once completed, iterate the pipeline and add all tasks to the queue.\n * 4. do the same for the \"middle\" and \"end\" groups.\n *\n * the reason for splitting the tasks to the three groups and not using the \"dependencies\" field\n * alone to determine the order is that the \"start\" and \"end\" groups are mostly core and \"middle\"\n * is mostly the user entering tasks to the pipeline and we as the core don't know about the users\n * tasks. For example, a core task \"PublishComponent\" must happen after the compiler, however, a\n * user might have an env without a compiler. if we determine the order only by the dependencies\n * field, the \"PublishComponent\" would have a dependency \"compiler\" and because in this case there\n * is no compiler task, it would throw an error about missing dependencies.\n */\nexport function calculatePipelineOrder(\n taskSlot: TaskSlot,\n envs: EnvDefinition[],\n pipeNameOnEnv: PipeFunctionNames,\n tasks: string[] = [],\n skipTests = false\n): TasksQueue {\n const graphs: TasksLocationGraph[] = [];\n const locations: Location[] = ['start', 'middle', 'end']; // the order is important here!\n locations.forEach((location) => {\n graphs.push({ location, graph: new Graph<string, string>() });\n });\n const pipelineEnvs: PipelineEnv[] = [];\n envs.forEach((envDefinition) => {\n const pipeline = getPipelineForEnv(taskSlot, envDefinition.env, pipeNameOnEnv);\n pipelineEnvs.push({ env: envDefinition, pipeline });\n });\n\n const flattenedPipeline: BuildTask[] = pipelineEnvs.map((pipelineEnv) => pipelineEnv.pipeline).flat();\n flattenedPipeline.forEach((task) => addDependenciesToGraph(graphs, flattenedPipeline, task));\n\n const dataPerLocation: DataPerLocation[] = graphs.map(({ location, graph }) => {\n const pipelineEnvsPerLocation: PipelineEnv[] = pipelineEnvs.map(({ env, pipeline }) => {\n return { env, pipeline: pipeline.filter((task) => (task.location || 'middle') === location) };\n });\n return { location, graph, pipelineEnvs: pipelineEnvsPerLocation };\n });\n\n const tasksQueue = new TasksQueue();\n locations.forEach((location) => addTasksToGraph(tasksQueue, dataPerLocation, location));\n if (tasks.length) {\n return new TasksQueue(\n ...tasksQueue.filter(({ task }) => tasks.includes(task.name) || tasks.includes(task.aspectId))\n );\n }\n if (skipTests) {\n return new TasksQueue(...tasksQueue.filter(({ task }) => task.aspectId !== TesterAspect.id));\n }\n return tasksQueue;\n}\n\nfunction addTasksToGraph(tasksQueue: TasksQueue, dataPerLocation: DataPerLocation[], location: Location) {\n const data = dataPerLocation.find((d) => d.location === location);\n if (!data) return;\n const sorted = data.graph.toposort();\n sorted.forEach((taskNode) => {\n const { aspectId, name } = BuildTaskHelper.deserializeId(taskNode.attr);\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n const taskIndex = pipeline.findIndex(\n (pipelineTask) => pipelineTask.aspectId === aspectId && pipelineTask.name === name\n );\n if (taskIndex < 0) return;\n const task = pipeline[taskIndex];\n tasksQueue.push({ env, task });\n pipeline.splice(taskIndex, 1); // delete the task from the pipeline\n });\n });\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n pipeline.forEach((task) => tasksQueue.push({ env, task }));\n });\n}\n\nfunction addDependenciesToGraph(graphs: TasksLocationGraph[], pipeline: BuildTask[], task: BuildTask) {\n if (!task.dependencies || !task.dependencies.length) return;\n const taskId = BuildTaskHelper.serializeId(task);\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeIdAllowEmptyName(dependency);\n const dependencyTasks = pipeline.filter((pipelineTask) => {\n if (pipelineTask.aspectId !== aspectId) return false;\n return name ? name === pipelineTask.name : true;\n });\n if (dependencyTasks.length === 0) {\n throw new Error(\n `Pipeline error - missing task dependency \"${dependency}\" of the \"${BuildTaskHelper.serializeId(task)}\"`\n );\n }\n dependencyTasks.forEach((dependencyTask) => {\n const location = getLocation(task, dependencyTask);\n if (!location) {\n // the dependency is behind and will be in the correct order regardless the graph.\n return;\n }\n const graphLocation = graphs.find((g) => g.location === location);\n if (!graphLocation) throw new Error(`unable to find graph for location ${location}`);\n const dependencyId = BuildTaskHelper.serializeId(dependencyTask);\n const graph = graphLocation.graph;\n graph.setNode(new Node(taskId, taskId));\n graph.setNode(new Node(dependencyId, dependencyId));\n graph.setEdge(new Edge(dependencyId, taskId, 'dependency'));\n });\n });\n}\n\n/**\n * since the task execution is happening per group: \"start\", \"middle\" and \"end\", the dependencies\n * need to be inside the same group.\n * e.g. if a dependency located at \"end\" group and the task located at \"start\", it's impossible to\n * complete the dependency before the task, there it throws an error.\n * it's ok to have the dependency located earlier, e.g. \"start\" and the task at \"end\", and in this\n * case, it will not be part of the graph because there is no need to do any special calculation.\n */\nfunction getLocation(task: BuildTask, dependencyTask: BuildTask): Location | null {\n const taskLocation = task.location || 'middle';\n const dependencyLocation = dependencyTask.location || 'middle';\n\n const isDependencyAhead =\n (taskLocation === 'start' && dependencyLocation !== 'start') ||\n (taskLocation === 'middle' && dependencyLocation === 'end');\n\n const isDependencyEqual = taskLocation === dependencyLocation;\n\n if (isDependencyAhead) {\n throw new Error(`a task \"${BuildTaskHelper.serializeId(task)}\" located at ${taskLocation}\nhas a dependency \"${BuildTaskHelper.serializeId(dependencyTask)} located at ${dependencyLocation},\nwhich is invalid. the dependency must be located earlier or in the same location as the task\"`);\n }\n\n if (isDependencyEqual) {\n return taskLocation;\n }\n\n // dependency is behind. e.g. task is \"end\" and dependency is \"start\". no need to enter to the\n // graph as it's going to be executed in the right order regardless the graph.\n return null;\n}\n\nfunction getPipelineForEnv(taskSlot: TaskSlot, env: Environment, pipeNameOnEnv: string): BuildTask[] {\n const buildTasks: BuildTask[] = env[pipeNameOnEnv] ? env[pipeNameOnEnv]() : [];\n const slotsTasks = taskSlot.values().flat();\n const tasksAtStart: BuildTask[] = [];\n const tasksAtEnd: BuildTask[] = [];\n slotsTasks.forEach((task) => {\n if (task.location === 'start') {\n tasksAtStart.push(task);\n return;\n }\n if (task.location === 'end') {\n tasksAtEnd.push(task);\n return;\n }\n tasksAtStart.push(task);\n });\n\n // merge with extension registered tasks.\n const mergedTasks = [...tasksAtStart, ...buildTasks,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IAAI;AACb;AAEA,SAAShD,iBAAiBA,CAACf,QAAkB,EAAEgB,GAAgB,EAAEd,aAAqB,EAAe;EACnG,MAAMiE,UAAuB,GAAGnD,GAAG,CAACd,aAAa,CAAC,GAAGc,GAAG,CAACd,aAAa,CAAC,CAAC,CAAC,GAAG,EAAE;EAC9E,MAAMkE,UAAU,GAAGpE,QAAQ,CAACqE,MAAM,CAAC,CAAC,CAACjD,IAAI,CAAC,CAAC;EAC3C,MAAMkD,YAAyB,GAAG,EAAE;EACpC,MAAMC,UAAuB,GAAG,EAAE;EAClCH,UAAU,CAAC7D,OAAO,CAAEc,IAAI,IAAK;IAC3B,IAAIA,IAAI,CAACb,QAAQ,KAAK,OAAO,EAAE;MAC7B8D,YAAY,CAAC7D,IAAI,CAACY,IAAI,CAAC;MACvB;IACF;IACA,IAAIA,IAAI,CAACb,QAAQ,KAAK,KAAK,EAAE;MAC3B+D,UAAU,CAAC9D,IAAI,CAACY,IAAI,CAAC;MACrB;IACF;IACAiD,YAAY,CAAC7D,IAAI,CAACY,IAAI,CAAC;EACzB,CAAC,CAAC;;EAEF;EACA,MAAMmD,WAAW,GAAG,CAAC,GAAGF,YAAY,EAAE,GAAGH,UAAU,EAAE,GAAGI,UAAU,CAAC;EAEnE,OAAOC,WAAW;AACpB"}
|
|
1
|
+
{"version":3,"names":["_graph","data","require","_tester","_interopRequireDefault","_buildTask","_tasksQueue","obj","__esModule","default","calculatePipelineOrder","taskSlot","envs","pipeNameOnEnv","tasks","skipTests","graphs","locations","forEach","location","push","graph","Graph","pipelineEnvs","envDefinition","pipeline","getPipelineForEnv","env","flattenedPipeline","map","pipelineEnv","flat","task","addDependenciesToGraph","dataPerLocation","pipelineEnvsPerLocation","filter","tasksQueue","TasksQueue","addTasksToGraph","length","includes","name","aspectId","TesterAspect","id","find","d","sorted","toposort","taskNode","BuildTaskHelper","deserializeId","attr","taskIndex","findIndex","pipelineTask","splice","dependencies","taskId","serializeId","dependency","deserializeIdAllowEmptyName","dependencyTasks","Error","dependencyTask","getLocation","graphLocation","g","dependencyId","setNode","Node","setEdge","Edge","taskLocation","dependencyLocation","isDependencyAhead","isDependencyEqual","buildTasks","slotsTasks","values","tasksAtStart","tasksAtEnd","mergedTasks"],"sources":["build-pipeline-order.ts"],"sourcesContent":["import { Graph, Node, Edge } from '@teambit/graph.cleargraph';\nimport TesterAspect from '@teambit/tester';\nimport { EnvDefinition, Environment } from '@teambit/envs';\nimport { BuildTask, BuildTaskHelper } from './build-task';\nimport type { TaskSlot } from './builder.main.runtime';\nimport { TasksQueue } from './tasks-queue';\nimport { PipeFunctionNames } from './builder.service';\n\ntype TaskDependenciesGraph = Graph<string, string>;\ntype Location = 'start' | 'middle' | 'end';\ntype TasksLocationGraph = { location: Location; graph: TaskDependenciesGraph };\ntype PipelineEnv = { env: EnvDefinition; pipeline: BuildTask[] };\ntype DataPerLocation = { location: Location; graph: TaskDependenciesGraph; pipelineEnvs: PipelineEnv[] };\n\n/**\n * there are two ways how to add tasks to build pipeline.\n * 1. `getBuildPipe()` method of the env.\n * 2. registering to the `builder.registerBuildTask()`.\n *\n * in the option #1, it's possible to determine the order. e.g. `getBuildPipe() { return [taskA, taskB, taskC]; }`\n * in the option #2, the register happens once the extension is loaded, so there is no way to put\n * one task before/after another task.\n *\n * To be able to determine the order, you can do the following\n * 1. \"task.location\", it has two options \"start\" and \"end\". the rest are \"middle\".\n * 2. \"task.dependencies\", the dependencies must be completed for all envs before this task starts.\n * the dependencies are applicable inside a location and not across locations. see getLocation()\n * or/and continue reading for more info about this.\n *\n * to determine the final order of the tasks, the following is done:\n * 1. split all tasks to three groups: start, middle and end.\n * 2. for each group define a dependencies graph for the tasks with \"dependencies\" prop and the pipeline.\n * 3. start with the first group \"start\", toposort the dependencies graph and push the found tasks\n * to a queue. once completed, iterate the pipeline and add all tasks to the queue.\n * 4. do the same for the \"middle\" and \"end\" groups.\n *\n * the reason for splitting the tasks to the three groups and not using the \"dependencies\" field\n * alone to determine the order is that the \"start\" and \"end\" groups are mostly core and \"middle\"\n * is mostly the user entering tasks to the pipeline and we as the core don't know about the users\n * tasks. For example, a core task \"PublishComponent\" must happen after the compiler, however, a\n * user might have an env without a compiler. if we determine the order only by the dependencies\n * field, the \"PublishComponent\" would have a dependency \"compiler\" and because in this case there\n * is no compiler task, it would throw an error about missing dependencies.\n */\nexport function calculatePipelineOrder(\n taskSlot: TaskSlot,\n envs: EnvDefinition[],\n pipeNameOnEnv: PipeFunctionNames,\n tasks: string[] = [],\n skipTests = false\n): TasksQueue {\n const graphs: TasksLocationGraph[] = [];\n const locations: Location[] = ['start', 'middle', 'end']; // the order is important here!\n locations.forEach((location) => {\n graphs.push({ location, graph: new Graph<string, string>() });\n });\n const pipelineEnvs: PipelineEnv[] = [];\n envs.forEach((envDefinition) => {\n const pipeline = getPipelineForEnv(taskSlot, envDefinition.env, pipeNameOnEnv);\n pipelineEnvs.push({ env: envDefinition, pipeline });\n });\n\n const flattenedPipeline: BuildTask[] = pipelineEnvs.map((pipelineEnv) => pipelineEnv.pipeline).flat();\n flattenedPipeline.forEach((task) => addDependenciesToGraph(graphs, flattenedPipeline, task));\n\n const dataPerLocation: DataPerLocation[] = graphs.map(({ location, graph }) => {\n const pipelineEnvsPerLocation: PipelineEnv[] = pipelineEnvs.map(({ env, pipeline }) => {\n return { env, pipeline: pipeline.filter((task) => (task.location || 'middle') === location) };\n });\n return { location, graph, pipelineEnvs: pipelineEnvsPerLocation };\n });\n\n const tasksQueue = new TasksQueue();\n locations.forEach((location) => addTasksToGraph(tasksQueue, dataPerLocation, location));\n if (tasks.length) {\n return new TasksQueue(\n ...tasksQueue.filter(({ task }) => tasks.includes(task.name) || tasks.includes(task.aspectId))\n );\n }\n if (skipTests) {\n return new TasksQueue(...tasksQueue.filter(({ task }) => task.aspectId !== TesterAspect.id));\n }\n return tasksQueue;\n}\n\nfunction addTasksToGraph(tasksQueue: TasksQueue, dataPerLocation: DataPerLocation[], location: Location) {\n const data = dataPerLocation.find((d) => d.location === location);\n if (!data) return;\n const sorted = data.graph.toposort();\n sorted.forEach((taskNode) => {\n const { aspectId, name } = BuildTaskHelper.deserializeId(taskNode.attr);\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n const taskIndex = pipeline.findIndex(\n (pipelineTask) => pipelineTask.aspectId === aspectId && pipelineTask.name === name\n );\n if (taskIndex < 0) return;\n const task = pipeline[taskIndex];\n tasksQueue.push({ env, task });\n pipeline.splice(taskIndex, 1); // delete the task from the pipeline\n });\n });\n data.pipelineEnvs.forEach(({ env, pipeline }) => {\n pipeline.forEach((task) => tasksQueue.push({ env, task }));\n });\n}\n\nfunction addDependenciesToGraph(graphs: TasksLocationGraph[], pipeline: BuildTask[], task: BuildTask) {\n if (!task.dependencies || !task.dependencies.length) return;\n const taskId = BuildTaskHelper.serializeId(task);\n task.dependencies.forEach((dependency) => {\n const { aspectId, name } = BuildTaskHelper.deserializeIdAllowEmptyName(dependency);\n const dependencyTasks = pipeline.filter((pipelineTask) => {\n if (pipelineTask.aspectId !== aspectId) return false;\n return name ? name === pipelineTask.name : true;\n });\n if (dependencyTasks.length === 0) {\n throw new Error(\n `Pipeline error - missing task dependency \"${dependency}\" of the \"${BuildTaskHelper.serializeId(task)}\"`\n );\n }\n dependencyTasks.forEach((dependencyTask) => {\n const location = getLocation(task, dependencyTask);\n if (!location) {\n // the dependency is behind and will be in the correct order regardless the graph.\n return;\n }\n const graphLocation = graphs.find((g) => g.location === location);\n if (!graphLocation) throw new Error(`unable to find graph for location ${location}`);\n const dependencyId = BuildTaskHelper.serializeId(dependencyTask);\n const graph = graphLocation.graph;\n graph.setNode(new Node(taskId, taskId));\n graph.setNode(new Node(dependencyId, dependencyId));\n graph.setEdge(new Edge(dependencyId, taskId, 'dependency'));\n });\n });\n}\n\n/**\n * since the task execution is happening per group: \"start\", \"middle\" and \"end\", the dependencies\n * need to be inside the same group.\n * e.g. if a dependency located at \"end\" group and the task located at \"start\", it's impossible to\n * complete the dependency before the task, there it throws an error.\n * it's ok to have the dependency located earlier, e.g. \"start\" and the task at \"end\", and in this\n * case, it will not be part of the graph because there is no need to do any special calculation.\n */\nfunction getLocation(task: BuildTask, dependencyTask: BuildTask): Location | null {\n const taskLocation = task.location || 'middle';\n const dependencyLocation = dependencyTask.location || 'middle';\n\n const isDependencyAhead =\n (taskLocation === 'start' && dependencyLocation !== 'start') ||\n (taskLocation === 'middle' && dependencyLocation === 'end');\n\n const isDependencyEqual = taskLocation === dependencyLocation;\n\n if (isDependencyAhead) {\n throw new Error(`a task \"${BuildTaskHelper.serializeId(task)}\" located at ${taskLocation}\nhas a dependency \"${BuildTaskHelper.serializeId(dependencyTask)} located at ${dependencyLocation},\nwhich is invalid. the dependency must be located earlier or in the same location as the task\"`);\n }\n\n if (isDependencyEqual) {\n return taskLocation;\n }\n\n // dependency is behind. e.g. task is \"end\" and dependency is \"start\". no need to enter to the\n // graph as it's going to be executed in the right order regardless the graph.\n return null;\n}\n\nfunction getPipelineForEnv(taskSlot: TaskSlot, env: Environment, pipeNameOnEnv: string): BuildTask[] {\n const buildTasks: BuildTask[] = env[pipeNameOnEnv] ? env[pipeNameOnEnv]() : [];\n const slotsTasks = taskSlot.values().flat();\n const tasksAtStart: BuildTask[] = [];\n const tasksAtEnd: BuildTask[] = [];\n slotsTasks.forEach((task) => {\n if (task.location === 'start') {\n tasksAtStart.push(task);\n return;\n }\n if (task.location === 'end') {\n tasksAtEnd.push(task);\n return;\n }\n tasksAtStart.push(task);\n });\n\n // merge with extension registered tasks.\n const mergedTasks = [...tasksAtStart, ...buildTasks, ...tasksAtEnd];\n\n return mergedTasks;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,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,CAAC,CAAC,GAAG,EAAE;EAC9E,MAAMkE,UAAU,GAAGpE,QAAQ,CAACqE,MAAM,CAAC,CAAC,CAACjD,IAAI,CAAC,CAAC;EAC3C,MAAMkD,YAAyB,GAAG,EAAE;EACpC,MAAMC,UAAuB,GAAG,EAAE;EAClCH,UAAU,CAAC7D,OAAO,CAAEc,IAAI,IAAK;IAC3B,IAAIA,IAAI,CAACb,QAAQ,KAAK,OAAO,EAAE;MAC7B8D,YAAY,CAAC7D,IAAI,CAACY,IAAI,CAAC;MACvB;IACF;IACA,IAAIA,IAAI,CAACb,QAAQ,KAAK,KAAK,EAAE;MAC3B+D,UAAU,CAAC9D,IAAI,CAACY,IAAI,CAAC;MACrB;IACF;IACAiD,YAAY,CAAC7D,IAAI,CAACY,IAAI,CAAC;EACzB,CAAC,CAAC;;EAEF;EACA,MAAMmD,WAAW,GAAG,CAAC,GAAGF,YAAY,EAAE,GAAGH,UAAU,EAAE,GAAGI,UAAU,CAAC;EAEnE,OAAOC,WAAW;AACpB"}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.symbol.description.js");
|
|
5
|
-
require("core-js/modules/es.array.flat-map.js");
|
|
6
|
-
require("core-js/modules/es.array.iterator.js");
|
|
7
|
-
require("core-js/modules/es.array.unscopables.flat-map.js");
|
|
8
3
|
Object.defineProperty(exports, "__esModule", {
|
|
9
4
|
value: true
|
|
10
5
|
});
|
|
11
6
|
exports.BuildPipelineResultList = void 0;
|
|
12
|
-
function _defineProperty2() {
|
|
13
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
_defineProperty2 = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
7
|
function _component() {
|
|
20
8
|
const data = require("@teambit/component");
|
|
21
9
|
_component = function () {
|
|
@@ -38,7 +26,10 @@ function _artifact() {
|
|
|
38
26
|
return data;
|
|
39
27
|
}
|
|
40
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
32
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
42
33
|
/**
|
|
43
34
|
* Helper to get the data and artifacts from the TasksResultsList before saving during the tag
|
|
44
35
|
*/
|
|
@@ -46,7 +37,7 @@ class BuildPipelineResultList {
|
|
|
46
37
|
constructor(tasksResults, components) {
|
|
47
38
|
this.tasksResults = tasksResults;
|
|
48
39
|
this.components = components;
|
|
49
|
-
(
|
|
40
|
+
_defineProperty(this, "artifactListsMap", void 0);
|
|
50
41
|
this.artifactListsMap = this.getFlattenedArtifactListsMapFromAllTasks();
|
|
51
42
|
}
|
|
52
43
|
getFlattenedArtifactListsMapFromAllTasks() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_component","data","require","_lodash","_artifact","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","BuildPipelineResultList","constructor","tasksResults","components","artifactListsMap","getFlattenedArtifactListsMapFromAllTasks","artifactListsMaps","flatMap","t","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","_this$artifactListsMa","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,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,C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AAA3D,uBAAA,GAAAA,uBAAA"}
|
|
1
|
+
{"version":3,"names":["_component","data","require","_lodash","_artifact","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","BuildPipelineResultList","constructor","tasksResults","components","artifactListsMap","getFlattenedArtifactListsMapFromAllTasks","artifactListsMaps","flatMap","t","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","_this$artifactListsMa","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,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,IAAAC,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AA,GAAO,IAAI,CAAC/C,gBAAgB,CAACW,qBAAqB,CAACK,WAAW,CAAC,cAAA+B,qBAAA,uBAAxDA,qBAAA,CAA0DC,QAAQ,CAAC,CAAC;EAC7E;EAEQlB,mBAAmBA,CAACmB,WAAyB,EAAEC,YAAsC,EAAExB,MAAc,EAAE;IAC7G,IAAI,CAACwB,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,QAAOvB,MAAO,EAAC,CAAC;IACxF;IACA,IAAI2B,KAAK,CAACC,OAAO,CAACL,WAAW,CAAC,EAAE;MAC9B,MAAM,IAAIG,KAAK,CAAE,6CAA4C1B,MAAO,EAAC,CAAC;IACxE;IACA,OAAA5D,aAAA,CAAAA,aAAA,KAAYmF,WAAW,GAAKC,YAAY;EAC1C;AACF;AAACK,OAAA,CAAA3D,uBAAA,GAAAA,uBAAA"}
|
package/dist/build-task.js
CHANGED
package/dist/build-task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TaskIdDelimiter","exports","CAPSULE_ARTIFACTS_DIR","BuildTaskHelper","serializeId","aspectId","name","deserializeId","id","split","length","Error","deserializeIdAllowEmptyName","includes","undefined"],"sources":["build-task.ts"],"sourcesContent":["import type { Component } from '@teambit/component';\nimport { LaneId } from '@teambit/lane-id';\nimport { ExecutionContext } from '@teambit/envs';\nimport type { Network } from '@teambit/isolator';\nimport type { ComponentResult } from './types';\nimport type { ArtifactDefinition } from './artifact';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskResults } from './build-pipe';\nimport { PipeName } from './builder.service';\n\nexport type TaskLocation = 'start' | 'end';\n\n/**\n * delimiter between task.aspectId and task.name\n */\nexport const TaskIdDelimiter = ':';\n\n/**\n * A folder to write artifacts generated during a build task\n * This folder is used in the core envs and excluded by default from the package tar file (the core envs is writing this into the npmignore file)\n */\nexport const CAPSULE_ARTIFACTS_DIR = 'artifacts';\n\nexport interface BuildContext extends ExecutionContext {\n /**\n * all components about to be built/tagged.\n */\n components: Component[];\n\n /**\n * network of capsules ready to be built.\n */\n capsuleNetwork: Network;\n\n /**\n * data generated by tasks that were running before this task\n */\n previousTasksResults: TaskResults[];\n\n /**\n * Run the build pipeline in dev mode\n */\n dev?: boolean;\n\n /**\n * pipe name such as \"build\", \"tas\", \"snap\".\n * an example usage is \"deploy\" task which is running in snap and tag pipeline and has different needs in each one.\n */\n pipeName: PipeName;\n\n /**\n * current lane-id if exists. empty when on main.\n */\n laneId?: LaneId;\n}\n\nexport interface TaskDescriptor {\n aspectId: string;\n name?: string;\n description?: string;\n}\n\nexport interface BuildTask {\n /**\n * aspect id serialized of the creator of the task.\n * todo: automate this so then it won't be needed to pass manually.\n */\n aspectId: string;\n\n /**\n * name of the task. function as an identifier among other tasks of the same aspectId.\n * spaces and special characters are not allowed. as a convention, use UpperCamelCase style.\n * (e.g. TypescriptCompiler).\n */\n name: string;\n\n /**\n * description of what the task does.\n * if available, the logger will log it show it in the status-line.\n */\n description?: string;\n\n /**\n * where to put the task, before the env pipeline or after\n */\n location?: TaskLocation;\n\n /**\n * execute a task in a build context\n */\n execute(context: BuildContext): Promise<BuiltTaskResult>;\n\n /**\n * run before the build pipeline has started. this is useful when some preparation are needed to\n * be done on all envs before the build starts.\n * e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will\n * cause dependencies from other envs to get this tsconfig written.\n */\n preBuild?(context: BuildContext): Promise<void>;\n\n /**\n * run after the build pipeline completed for all envs. useful for doing some cleanup on the\n * capsules before the deployment starts.\n */\n postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;\n\n /**\n * needed if you want the task to be running only after the dependencies were completed\n * for *all* envs.\n * normally this is not needed because the build-pipeline runs the tasks in the same order\n * they're located in the `getBuildPipe()` array and according to the task.location.\n * the case where this is useful is when a task not only needs to be after another task, but also\n * after all environments were running that task.\n * a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use\n * \"aspectId:name\", e.g. \"teambit.compilation/compiler:TypescriptCompiler\".\n */\n dependencies?: string[];\n}\n\n// TODO: rename to BuildTaskResults\nexport interface BuiltTaskResult {\n /**\n * build results for each of the components in the build context.\n */\n componentsResults: ComponentResult[];\n\n /**\n * array of artifact definitions to generate after a successful build.\n */\n artifacts?: ArtifactDefinition[];\n}\n\nexport class BuildTaskHelper {\n static serializeId({ aspectId, name }: { aspectId: string; name: string }): string {\n return aspectId + TaskIdDelimiter + name;\n }\n static deserializeId(id: string): { aspectId: string; name: string } {\n const split = id.split(TaskIdDelimiter);\n if (split.length === 0) throw new Error(`deserializeId, ${id} is empty`);\n if (split.length === 1) throw new Error(`deserializeId, ${id} has only aspect-id without name`);\n if (split.length === 2) return { aspectId: split[0], name: split[1] };\n throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);\n }\n /**\n * don't throw an error when the id includes only the aspect-id without the task name.\n * useful for task dependencies, when it's allowed to specify the aspect-id only.\n */\n static deserializeIdAllowEmptyName(id: string): { aspectId: string; name?: string } {\n return id.includes(TaskIdDelimiter) ? BuildTaskHelper.deserializeId(id) : { aspectId: id, name: undefined };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["TaskIdDelimiter","exports","CAPSULE_ARTIFACTS_DIR","BuildTaskHelper","serializeId","aspectId","name","deserializeId","id","split","length","Error","deserializeIdAllowEmptyName","includes","undefined"],"sources":["build-task.ts"],"sourcesContent":["import type { Component } from '@teambit/component';\nimport { LaneId } from '@teambit/lane-id';\nimport { ExecutionContext } from '@teambit/envs';\nimport type { Network } from '@teambit/isolator';\nimport type { ComponentResult } from './types';\nimport type { ArtifactDefinition } from './artifact';\nimport { TaskResultsList } from './task-results-list';\nimport { TaskResults } from './build-pipe';\nimport { PipeName } from './builder.service';\n\nexport type TaskLocation = 'start' | 'end';\n\n/**\n * delimiter between task.aspectId and task.name\n */\nexport const TaskIdDelimiter = ':';\n\n/**\n * A folder to write artifacts generated during a build task\n * This folder is used in the core envs and excluded by default from the package tar file (the core envs is writing this into the npmignore file)\n */\nexport const CAPSULE_ARTIFACTS_DIR = 'artifacts';\n\nexport interface BuildContext extends ExecutionContext {\n /**\n * all components about to be built/tagged.\n */\n components: Component[];\n\n /**\n * network of capsules ready to be built.\n */\n capsuleNetwork: Network;\n\n /**\n * data generated by tasks that were running before this task\n */\n previousTasksResults: TaskResults[];\n\n /**\n * Run the build pipeline in dev mode\n */\n dev?: boolean;\n\n /**\n * pipe name such as \"build\", \"tas\", \"snap\".\n * an example usage is \"deploy\" task which is running in snap and tag pipeline and has different needs in each one.\n */\n pipeName: PipeName;\n\n /**\n * current lane-id if exists. empty when on main.\n */\n laneId?: LaneId;\n}\n\nexport interface TaskDescriptor {\n aspectId: string;\n name?: string;\n description?: string;\n}\n\nexport interface BuildTask {\n /**\n * aspect id serialized of the creator of the task.\n * todo: automate this so then it won't be needed to pass manually.\n */\n aspectId: string;\n\n /**\n * name of the task. function as an identifier among other tasks of the same aspectId.\n * spaces and special characters are not allowed. as a convention, use UpperCamelCase style.\n * (e.g. TypescriptCompiler).\n */\n name: string;\n\n /**\n * description of what the task does.\n * if available, the logger will log it show it in the status-line.\n */\n description?: string;\n\n /**\n * where to put the task, before the env pipeline or after\n */\n location?: TaskLocation;\n\n /**\n * execute a task in a build context\n */\n execute(context: BuildContext): Promise<BuiltTaskResult>;\n\n /**\n * run before the build pipeline has started. this is useful when some preparation are needed to\n * be done on all envs before the build starts.\n * e.g. typescript compiler needs to write the tsconfig file. doing it during the task, will\n * cause dependencies from other envs to get this tsconfig written.\n */\n preBuild?(context: BuildContext): Promise<void>;\n\n /**\n * run after the build pipeline completed for all envs. useful for doing some cleanup on the\n * capsules before the deployment starts.\n */\n postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;\n\n /**\n * needed if you want the task to be running only after the dependencies were completed\n * for *all* envs.\n * normally this is not needed because the build-pipeline runs the tasks in the same order\n * they're located in the `getBuildPipe()` array and according to the task.location.\n * the case where this is useful is when a task not only needs to be after another task, but also\n * after all environments were running that task.\n * a dependency is task.aspectId. if an aspect has multiple tasks, to be more specific, use\n * \"aspectId:name\", e.g. \"teambit.compilation/compiler:TypescriptCompiler\".\n */\n dependencies?: string[];\n}\n\n// TODO: rename to BuildTaskResults\nexport interface BuiltTaskResult {\n /**\n * build results for each of the components in the build context.\n */\n componentsResults: ComponentResult[];\n\n /**\n * array of artifact definitions to generate after a successful build.\n */\n artifacts?: ArtifactDefinition[];\n}\n\nexport class BuildTaskHelper {\n static serializeId({ aspectId, name }: { aspectId: string; name: string }): string {\n return aspectId + TaskIdDelimiter + name;\n }\n static deserializeId(id: string): { aspectId: string; name: string } {\n const split = id.split(TaskIdDelimiter);\n if (split.length === 0) throw new Error(`deserializeId, ${id} is empty`);\n if (split.length === 1) throw new Error(`deserializeId, ${id} has only aspect-id without name`);\n if (split.length === 2) return { aspectId: split[0], name: split[1] };\n throw new Error(`deserializeId, id ${id} has more than one ${TaskIdDelimiter}`);\n }\n /**\n * don't throw an error when the id includes only the aspect-id without the task name.\n * useful for task dependencies, when it's allowed to specify the aspect-id only.\n */\n static deserializeIdAllowEmptyName(id: string): { aspectId: string; name?: string } {\n return id.includes(TaskIdDelimiter) ? BuildTaskHelper.deserializeId(id) : { aspectId: id, name: undefined };\n }\n}\n"],"mappings":";;;;;;AAYA;AACA;AACA;AACO,MAAMA,eAAe,GAAG,GAAG;;AAElC;AACA;AACA;AACA;AAHAC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAIO,MAAME,qBAAqB,GAAG,WAAW;;AAkGhD;AAAAD,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAaO,MAAMC,eAAe,CAAC;EAC3B,OAAOC,WAAWA,CAAC;IAAEC,QAAQ;IAAEC;EAAyC,CAAC,EAAU;IACjF,OAAOD,QAAQ,GAAGL,eAAe,GAAGM,IAAI;EAC1C;EACA,OAAOC,aAAaA,CAACC,EAAU,EAAsC;IACnE,MAAMC,KAAK,GAAGD,EAAE,CAACC,KAAK,CAACT,eAAe,CAAC;IACvC,IAAIS,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE,MAAM,IAAIC,KAAK,CAAE,kBAAiBH,EAAG,WAAU,CAAC;IACxE,IAAIC,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE,MAAM,IAAIC,KAAK,CAAE,kBAAiBH,EAAG,kCAAiC,CAAC;IAC/F,IAAIC,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE,OAAO;MAAEL,QAAQ,EAAEI,KAAK,CAAC,CAAC,CAAC;MAAEH,IAAI,EAAEG,KAAK,CAAC,CAAC;IAAE,CAAC;IACrE,MAAM,IAAIE,KAAK,CAAE,qBAAoBH,EAAG,sBAAqBR,eAAgB,EAAC,CAAC;EACjF;EACA;AACF;AACA;AACA;EACE,OAAOY,2BAA2BA,CAACJ,EAAU,EAAuC;IAClF,OAAOA,EAAE,CAACK,QAAQ,CAACb,eAAe,CAAC,GAAGG,eAAe,CAACI,aAAa,CAACC,EAAE,CAAC,GAAG;MAAEH,QAAQ,EAAEG,EAAE;MAAEF,IAAI,EAAEQ;IAAU,CAAC;EAC7G;AACF;AAACb,OAAA,CAAAE,eAAA,GAAAA,eAAA"}
|
package/dist/build.cmd.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.array.iterator.js");
|
|
5
|
-
require("core-js/modules/es.promise.js");
|
|
6
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
7
|
-
require("core-js/modules/es.string.trim.js");
|
|
8
3
|
Object.defineProperty(exports, "__esModule", {
|
|
9
4
|
value: true
|
|
10
5
|
});
|
|
11
6
|
exports.BuilderCmd = void 0;
|
|
12
|
-
function _defineProperty2() {
|
|
13
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
_defineProperty2 = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
7
|
function _workspace() {
|
|
20
8
|
const data = require("@teambit/workspace");
|
|
21
9
|
_workspace = function () {
|
|
@@ -37,22 +25,26 @@ function _chalk() {
|
|
|
37
25
|
};
|
|
38
26
|
return data;
|
|
39
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
31
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
40
32
|
class BuilderCmd {
|
|
41
33
|
constructor(builder, workspace, logger) {
|
|
42
34
|
this.builder = builder;
|
|
43
35
|
this.workspace = workspace;
|
|
44
36
|
this.logger = logger;
|
|
45
|
-
(
|
|
46
|
-
(
|
|
47
|
-
(
|
|
48
|
-
(
|
|
37
|
+
_defineProperty(this, "name", 'build [component-pattern]');
|
|
38
|
+
_defineProperty(this, "description", 'run set of tasks for build. ');
|
|
39
|
+
_defineProperty(this, "extendedDescription", 'by default, only new and modified components are built');
|
|
40
|
+
_defineProperty(this, "arguments", [{
|
|
49
41
|
name: 'component-pattern',
|
|
50
42
|
description: _constants().COMPONENT_PATTERN_HELP
|
|
51
43
|
}]);
|
|
52
|
-
(
|
|
53
|
-
(
|
|
54
|
-
(
|
|
55
|
-
(
|
|
44
|
+
_defineProperty(this, "helpUrl", 'reference/build-pipeline/builder-overview');
|
|
45
|
+
_defineProperty(this, "alias", '');
|
|
46
|
+
_defineProperty(this, "group", 'development');
|
|
47
|
+
_defineProperty(this, "options", [['a', 'all', 'DEPRECATED. use --unmodified'], ['u', 'unmodified', 'include unmodified components (by default, only new and modified components are built)'], ['d', 'dev', 'run the pipeline in dev mode'], ['', 'install', 'install core aspects in capsules'], ['', 'reuse-capsules', 'avoid deleting the capsules root-dir before starting the build'], ['', 'tasks <string>', `build the specified task(s) only. for multiple tasks, separate by a comma and wrap with quotes.
|
|
56
48
|
specify the task-name (e.g. "TypescriptCompiler") or the task-aspect-id (e.g. teambit.compilation/compiler)`], ['', 'cache-packages-on-capsule-root', 'set the package-manager cache on the capsule root'], ['', 'list-tasks <string>', 'list tasks of an env or a component-id for each one of the pipelines: build, tag and snap'], ['', 'skip-tests', 'skip running component tests during build process'], ['', 'fail-fast', 'stop pipeline execution on the first failed task (by default a task is skipped only when its dependency failed)']]);
|
|
57
49
|
}
|
|
58
50
|
async report([pattern], {
|
package/dist/build.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_workspace","data","require","_constants","_chalk","_interopRequireDefault","BuilderCmd","constructor","builder","workspace","logger","_defineProperty2","default","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","dev","install","cachePackagesOnCapsulesRoot","reuseCapsules","tasks","listTasks","skipTests","failFast","OutsideWorkspaceError","consoleWarning","getListTasks","longProcessLogger","createLongProcessLogger","components","getComponentsByUserInput","length","chalk","bold","envsExecutionResults","build","installOptions","installTeambitBit","packageManagerConfigRootDir","path","linkingOptions","linkTeambitBit","emptyRootDir","getExistingAsIs","split","map","task","trim","exitOnFirstFailedTask","end","hasErrors","throwErrorsIfExist","green","tasksQueue","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 { 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};\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 ] 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 }: 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 const longProcessLogger = this.logger.createLongProcessLogger('build');\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 longProcessLogger.end(envsExecutionResults.hasErrors() ? 'error' : 'success');\n envsExecutionResults.throwErrorsIfExist();\n return chalk.green(`build complete. total: ${envsExecutionResults.tasksQueue.length} tasks`);\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,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EA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qB,CAAE;AACpC,EAAE0B,OAAO,CAACM,QAAQ,CAACD,IAAI,CAAC,IAAI,CAAE;AAC9B;AACA,EAAEhC,gBAAK,CAACC,IAAI,CAAC,sBAAsB,CAAE;AACrC,EAAE0B,OAAO,CAACO,SAAS,CAACF,IAAI,CAAC,IAAI,CAAC,IAAI,OAAQ,EAAC;EACzC;AACF;AAACG,OAAA,CAAAjE,UAAA,GAAAA,UAAA"}
|
|
1
|
+
{"version":3,"names":["_workspace","data","require","_constants","_chalk","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","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","OutsideWorkspaceError","consoleWarning","getListTasks","longProcessLogger","createLongProcessLogger","components","getComponentsByUserInput","length","chalk","bold","envsExecutionResults","build","installOptions","installTeambitBit","packageManagerConfigRootDir","path","linkingOptions","linkTeambitBit","emptyRootDir","getExistingAsIs","split","map","task","trim","exitOnFirstFailedTask","end","hasErrors","throwErrorsIfExist","green","tasksQueue","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 { 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};\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 ] 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 }: 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 const longProcessLogger = this.logger.createLongProcessLogger('build');\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 longProcessLogger.end(envsExecutionResults.hasErrors() ? 'error' : 'success');\n envsExecutionResults.throwErrorsIfExist();\n return chalk.green(`build complete. total: ${envsExecutionResults.tasksQueue.length} tasks`);\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,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAI,uBAAAC,GAAA,WAAAA,GAA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AAO,CAACe,SAAS,CAACoC,SAAS,CAAC;IACjD,OAAQ,GAAEzB,gBAAK,CAACoB,KAAK,CAAC,WAAW,CAAE;AACvC,SAASO,OAAO,CAACC,EAAE,CAACC,QAAQ,CAAC,CAAE;AAC/B,SAASF,OAAO,CAACG,KAAM;AACvB;AACA,EAAE9B,gBAAK,CAACC,IAAI,CAAC,uBAAuB,CAAE;AACtC,EAAE0B,OAAO,CAACI,UAAU,CAACC,IAAI,CAAC,IAAI,CAAE;AAChC;AACA,EAAEhC,gBAAK,CAACC,IAAI,CAAC,qBAAqB,CAAE;AACpC,EAAE0B,OAAO,CAACM,QAAQ,CAACD,IAAI,CAAC,IAAI,CAAE;AAC9B;AACA,EAAEhC,gBAAK,CAACC,IAAI,CAAC,sBAAsB,CAAE;AACrC,EAAE0B,OAAO,CAACO,SAAS,CAACF,IAAI,CAAC,IAAI,CAAC,IAAI,OAAQ,EAAC;EACzC;AACF;AAACG,OAAA,CAAA/D,UAAA,GAAAA,UAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -12,6 +11,7 @@ function _react() {
|
|
|
12
11
|
};
|
|
13
12
|
return data;
|
|
14
13
|
}
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
16
16
|
style: {
|
|
17
17
|
height: '100%',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","obj","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["builder.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/builder.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAqD,CAAE,CACnF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA"}
|
package/dist/builder.graphql.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.symbol.description.js");
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
require("core-js/modules/es.promise.js");
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
6
|
exports.builderSchema = builderSchema;
|
|
11
|
-
function _defineProperty2() {
|
|
12
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
_defineProperty2 = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
7
|
function _graphqlTag() {
|
|
19
8
|
const data = _interopRequireDefault(require("graphql-tag"));
|
|
20
9
|
_graphqlTag = function () {
|
|
@@ -29,8 +18,12 @@ function _isBinaryPath() {
|
|
|
29
18
|
};
|
|
30
19
|
return data;
|
|
31
20
|
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
34
27
|
function builderSchema(builder, logger) {
|
|
35
28
|
return {
|
|
36
29
|
typeDefs: (0, _graphqlTag().default)`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphqlTag","data","_interopRequireDefault","require","_isBinaryPath","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","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","e","error","result","find","taskName","TaskReport","taskReport","taskDescription","errors","_taskReport$errors","warnings","pathFilter","_taskReport$artifact","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,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAA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A8B,CAAC,KAAK;UAAA,IAAAC,oBAAA;UACnF,IAAI,CAACN,UAAU,CAACjC,QAAQ,EAAE,OAAOe,SAAS;UAC1C,OAAAhD,aAAA,CAAAA,aAAA;YACEkC,EAAE,EAAG,GAAEgC,UAAU,CAAC5C,MAAO,IAAG4C,UAAU,CAACF,QAAS,IAAC,CAAAQ,oBAAA,GAAEN,UAAU,CAACjC,QAAQ,cAAAuC,oBAAA,uBAAnBA,oBAAA,CAAqBnC,IAAK,IAAGkC,UAAU,IAAI,EAAG;UAAC,GAC/FL,UAAU,CAACjC,QAAQ;YACtB0B,KAAK,EAAEO,UAAU,CAACjC,QAAQ,CAAC0B,KAAK,CAACjE,MAAM,CAAE+E,IAAI,IAAK,CAACF,UAAU,IAAIE,IAAI,CAAC/B,IAAI,KAAK6B,UAAU;UAAC;QAE9F;MACF;IACF;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["_graphqlTag","data","_interopRequireDefault","require","_isBinaryPath","obj","__esModule","default","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","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","size","byteLength","downloadUrl","encodeURI","getDownloadUrlForArtifact","externalUrl","url","description","storage","generatedBy","files","e","error","result","find","taskName","TaskReport","taskReport","taskDescription","errors","_taskReport$errors","warnings","pathFilter","_taskReport$artifact","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,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0C,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf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AC,KAAI,EAAE;QAAA;QACrFsB,QAAQ,EAAGJ,UAAsB,IAAKA,UAAU,CAACI,QAAQ,IAAI,EAAE;QAC/DpC,QAAQ,EAAE,MAAAA,CAAOgC,UAAsB,EAAE;UAAEvB,IAAI,EAAE4B;QAA8B,CAAC,KAAK;UAAA,IAAAC,oBAAA;UACnF,IAAI,CAACN,UAAU,CAAChC,QAAQ,EAAE,OAAOzB,SAAS;UAC1C,OAAAxB,aAAA,CAAAA,aAAA;YACEkD,EAAE,EAAG,GAAE+B,UAAU,CAAC3C,MAAO,IAAG2C,UAAU,CAACF,QAAS,IAAC,CAAAQ,oBAAA,GAAEN,UAAU,CAAChC,QAAQ,cAAAsC,oBAAA,uBAAnBA,oBAAA,CAAqBlC,IAAK,IAAGiC,UAAU,IAAI,EAAG;UAAC,GAC/FL,UAAU,CAAChC,QAAQ;YACtByB,KAAK,EAAEO,UAAU,CAAChC,QAAQ,CAACyB,KAAK,CAAChF,MAAM,CAAE8F,IAAI,IAAK,CAACF,UAAU,IAAIE,IAAI,CAAC9B,IAAI,KAAK4B,UAAU;UAAC;QAE9F;MACF;IACF;EACF,CAAC;AACH"}
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.array.flat-map.js");
|
|
5
|
-
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
require("core-js/modules/es.array.unscopables.flat-map.js");
|
|
7
|
-
require("core-js/modules/es.promise.js");
|
|
8
3
|
Object.defineProperty(exports, "__esModule", {
|
|
9
4
|
value: true
|
|
10
5
|
});
|
|
11
6
|
exports.FILE_PATH_PARAM_DELIM = exports.BuilderMain = void 0;
|
|
12
|
-
function _defineProperty2() {
|
|
13
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
_defineProperty2 = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
7
|
function _lodash() {
|
|
20
8
|
const data = require("lodash");
|
|
21
9
|
_lodash = function () {
|
|
@@ -226,8 +214,12 @@ function _builder4() {
|
|
|
226
214
|
};
|
|
227
215
|
return data;
|
|
228
216
|
}
|
|
217
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
229
218
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
230
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
219
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
222
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // it gets undefined when importing it from './artifact'
|
|
231
223
|
const FILE_PATH_PARAM_DELIM = '~';
|
|
232
224
|
|
|
233
225
|
/**
|
|
@@ -536,9 +528,9 @@ class BuilderMain {
|
|
|
536
528
|
}
|
|
537
529
|
}
|
|
538
530
|
exports.BuilderMain = BuilderMain;
|
|
539
|
-
(
|
|
540
|
-
(
|
|
541
|
-
(
|
|
531
|
+
_defineProperty(BuilderMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
532
|
+
_defineProperty(BuilderMain, "runtime", _cli().MainRuntime);
|
|
533
|
+
_defineProperty(BuilderMain, "dependencies", [_cli().CLIAspect, _envs().EnvsAspect, _workspace().WorkspaceAspect, _scope().ScopeAspect, _isolator().IsolatorAspect, _logger().LoggerAspect, _aspectLoader().AspectLoaderAspect, _graphql().GraphqlAspect, _generator().GeneratorAspect, _component().ComponentAspect, _ui().UIAspect, _globalConfig().default]);
|
|
542
534
|
_builder().BuilderAspect.addRuntime(BuilderMain);
|
|
543
535
|
|
|
544
536
|
//# sourceMappingURL=builder.main.runtime.js.map
|