@teambit/renaming
Version:
53 lines (51 loc) • 2.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ScopeRenameOwnerCmd = void 0;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _scopeRename() {
const data = require("./scope-rename.cmd");
_scopeRename = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
class ScopeRenameOwnerCmd {
constructor(renaming) {
this.renaming = renaming;
_defineProperty(this, "name", 'rename-owner <current-owner-name> <new-owner-name>');
_defineProperty(this, "description", "Renames the owner part of the scope-name for all components with the specified 'current owner name'");
_defineProperty(this, "arguments", [{
name: 'current-owner-name',
description: 'the owner name to be replaced by another owner name'
}, {
name: 'new-owner-name',
description: 'a new owner name to replace the current owner name'
}]);
_defineProperty(this, "options", [['r', 'refactor', 'update the import statements in all dependent components to the new package name (that contains the new owner name)'], ['', 'ast', 'use ast to transform files instead of regex']]);
_defineProperty(this, "group", 'component-config');
}
async report([oldName, newName], {
refactor
}) {
const results = await this.renaming.renameOwner(oldName, newName, {
refactor
});
const title = _chalk().default.green(`successfully replaced "${oldName}" owner with "${newName}"`);
const renameOutput = (0, _scopeRename().renameScopeOutput)(results);
return `${title}\n${renameOutput}`;
}
}
exports.ScopeRenameOwnerCmd = ScopeRenameOwnerCmd;
//# sourceMappingURL=scope-rename-owner.cmd.js.map