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
95 lines (69 loc) • 2.42 kB
JavaScript
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 _consumer() {
const data = require("../../../consumer");
_consumer = function () {
return data;
};
return data;
}
function _untagComponent() {
const data = require("../../../scope/component-ops/untag-component");
_untagComponent = function () {
return data;
};
return data;
}
function _hasWildcard() {
const data = _interopRequireDefault(require("../../../utils/string/has-wildcard"));
_hasWildcard = function () {
return data;
};
return data;
}
var _default = /*#__PURE__*/function () {
var _unTagAction = (0, _bluebird().coroutine)(function* (version, force, id) {
const consumer = yield (0, _consumer().loadConsumer)();
const untag = /*#__PURE__*/function () {
var _ref = (0, _bluebird().coroutine)(function* () {
const idHasWildcard = (0, _hasWildcard().default)(id);
if (idHasWildcard) {
return (0, _untagComponent().removeLocalVersionsForComponentsMatchedByWildcard)(consumer.scope, version, force, id);
}
if (id) {
const bitId = consumer.getParsedId(id); // a user might run the command `bit untag id@version` instead of `bit untag id version`
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
if (bitId.hasVersion() && !version) version = bitId.version;
const result = yield (0, _untagComponent().removeLocalVersion)(consumer.scope, bitId, version, force);
return [result];
} // untag all
return (0, _untagComponent().removeLocalVersionsForAllComponents)(consumer.scope, version, force);
});
return function untag() {
return _ref.apply(this, arguments);
};
}();
const results = yield untag();
yield consumer.scope.objects.persist();
const components = results.map(result => result.component);
yield consumer.updateComponentsVersions(components);
yield consumer.onDestroy();
return results;
});
function unTagAction(_x, _x2, _x3) {
return _unTagAction.apply(this, arguments);
}
return unTagAction;
}();
exports.default = _default;
;