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

119 lines (91 loc) 2.97 kB
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); Object.defineProperty(exports, "__esModule", { value: true }); exports.install = install; exports.installIds = installIds; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function path() { const data = _interopRequireWildcard(require("path")); path = function () { return data; }; return data; } function _links() { const data = require("../../links"); _links = function () { return data; }; return data; } function _installPackages() { const data = require("../../npm-client/install-packages"); _installPackages = function () { return data; }; return data; } function _constants() { const data = require("../../constants"); _constants = function () { return data; }; return data; } function _analytics() { const data = require("../../analytics/analytics"); _analytics = function () { return data; }; return data; } /** * does the following (the order is important): * 1) install npm packages of the consumer root. * 2) install npm packages of all imported and nested components * 3) link all components */ function install(_x, _x2) { return _install.apply(this, arguments); } /** * does the following (the order is important): * 1) install npm packages of the provided ids. * 2) link the provided ids. */ function _install() { _install = (0, _bluebird().coroutine)(function* (consumer, verbose) { const candidateComponents = consumer.bitMap.getAllComponents([_constants().COMPONENT_ORIGINS.IMPORTED, _constants().COMPONENT_ORIGINS.NESTED]); const dirs = candidateComponents.map(componentMap => componentMap.rootDir).filter(dir => dir); const consumerPath = consumer.getPath(); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! const dirsAbsolute = dirs.map(dir => path().join(consumerPath, dir)); yield (0, _installPackages().installPackages)(consumer, dirsAbsolute, verbose, true); return (0, _links().linkAllToNodeModules)(consumer); }); return _install.apply(this, arguments); } function installIds(_x3, _x4, _x5) { return _installIds.apply(this, arguments); } function _installIds() { _installIds = (0, _bluebird().coroutine)(function* (consumer, ids, verbose) { // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX! const { components } = yield consumer.loadComponents(ids); const dirs = components.map(component => component.componentMap.rootDir).filter(dir => dir); if (dirs.length) yield (0, _installPackages().installPackages)(consumer, dirs, verbose); _analytics().Analytics.setExtraData('num_components', components.length); const nodeModuleLinker = new (_links().NodeModuleLinker)(components, consumer, consumer.bitMap); return nodeModuleLinker.link(); }); return _installIds.apply(this, arguments); }