UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

67 lines (50 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BuilderService = void 0; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _buildPipe() { const data = require("./build-pipe"); _buildPipe = function () { return data; }; return data; } class BuilderService { constructor(isolator, workspace, logger) { this.isolator = isolator; this.workspace = workspace; this.logger = logger; } /** * runs a pipeline of tasks on all components in the execution context. */ run(context) { var _this = this; return (0, _bluebird().coroutine)(function* () { // make build pipe accessible throughout the context. if (!context.env.getPipe) { throw new Error(`Builder service expects ${context.id} to implement getPipe()`); } const buildTasks = context.env.getPipe(context); const buildPipe = _buildPipe().BuildPipe.from(buildTasks, _this.logger); _this.logger.info(context.id, `start running building pipe for "${context.id}". total ${buildPipe.tasks.length} tasks`); const buildContext = Object.assign(context, { capsuleGraph: yield _this.isolator.createNetworkFromConsumer(context.components.map(component => component.id.toString()), _this.workspace.consumer) }); const results = yield buildPipe.execute(buildContext); return { id: context.id, results }; })(); } } exports.BuilderService = BuilderService;