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

100 lines (70 loc) 2.66 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _bluebird() { const data = require("bluebird"); _bluebird = function () { return data; }; return data; } function _scope() { const data = require("../../../scope"); _scope = function () { return data; }; return data; } function _consumer() { const data = require("../../../consumer"); _consumer = function () { return data; }; return data; } function _logger() { const data = _interopRequireDefault(require("../../../logger/logger")); _logger = function () { return data; }; return data; } /** * Running migration process for consumer and / or scope - to update the stores (bitObjects, bit.map.json) to the current version * * @export * @param {string} scopePath - A path to scope directory, it a path was provided the migration won't run on consumer * @param {boolean} verbose - print debug logs * @returns {Promise<MigrationResult>} - wether the process run and wether it successeded */ var _default = /*#__PURE__*/function () { var _migrate = (0, _bluebird().coroutine)(function* (scopePath, verbose) { _logger().default.silly('migrate.migrate, starting migration process'); if (verbose) console.log('starting migration process'); // eslint-disable-line no-console let scope; // If a scope path provided we will run the migrate only for the scope if (scopePath) { _logger().default.silly(`migrate.migrate, running migration process for scope in path ${scopePath}`); if (verbose) console.log(`running migration process for scope in path ${scopePath}`); // eslint-disable-line no-console scope = yield (0, _scope().loadScope)(scopePath); return scope.migrate(verbose); } // If a scope path was not provided we will run the migrate on the consumer and for the scope const consumer = yield (0, _consumer().loadConsumerIfExist)(); if (!consumer) { return null; } scope = consumer.scope; yield consumer.migrate(verbose); // const consumerMigrationResult = await consumer.migrate(verbose); // if (!consumerMigrationResult) _logger().default.silly('migrate.migrate, running migration process for scope in consumer'); if (verbose) console.log('running migration process for scope in consumer'); // eslint-disable-line no-console return scope.migrate(verbose); }); function migrate(_x, _x2) { return _migrate.apply(this, arguments); } return migrate; }(); exports.default = _default;