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
111 lines (84 loc) • 2.98 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = provideWorkspace;
function _bluebird() {
const data = require("bluebird");
_bluebird = function () {
return data;
};
return data;
}
function _workspace() {
const data = _interopRequireDefault(require("./workspace"));
_workspace = function () {
return data;
};
return data;
}
function _consumer() {
const data = require("../../consumer");
_consumer = function () {
return data;
};
return data;
}
function _component() {
const data = _interopRequireDefault(require("../../consumer/component"));
_component = function () {
return data;
};
return data;
}
function _workspace2() {
const data = _interopRequireDefault(require("./workspace.graphql"));
_workspace2 = function () {
return data;
};
return data;
}
function _install() {
const data = _interopRequireDefault(require("./install.cmd"));
_install = function () {
return data;
};
return data;
}
function provideWorkspace(_x, _x2, _x3, _x4) {
return _provideWorkspace.apply(this, arguments);
}
function _provideWorkspace() {
_provideWorkspace = (0, _bluebird().coroutine)(function* ([cli, scope, component, isolator, dependencyResolver, variants, logger, graphql], config, _slots, harmony) {
// don't use loadConsumer() here because the consumer might not be available.
// also, this loadConsumerIfExist() is wrapped with try/catch in order not to break when the
// consumer can't be loaded due to .bitmap or bit.json issues which are fixed on a later phase
// open bit init --reset.
// keep in mind that here is the first place where the consumer is loaded.
// an unresolved issue here is when running tasks, such as "bit run build" outside of a consumer.
// we'll have to fix this asap.
try {
const consumer = yield (0, _consumer().loadConsumerIfExist)();
if (consumer) {
const workspace = new (_workspace().default)(config, consumer, scope, component, isolator, dependencyResolver, variants, logger.createLogPublisher('workspace'), // TODO: get the 'worksacpe' name in a better way
undefined, harmony);
_component().default.registerOnComponentConfigLoading('workspace', /*#__PURE__*/function () {
var _ref = (0, _bluebird().coroutine)(function* (id, componentConfig) {
return workspace.loadExtensions(componentConfig.parseExtensions());
});
return function (_x5, _x6) {
return _ref.apply(this, arguments);
};
}());
graphql.register((0, _workspace2().default)(workspace));
cli.register(new (_install().default)(workspace));
return workspace;
}
return undefined;
} catch (err) {
return undefined;
}
});
return _provideWorkspace.apply(this, arguments);
}
;