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
71 lines (54 loc) • 2.23 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FailedLoadForTag = void 0;
function _defineProperty2() {
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
_defineProperty2 = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _abstractError() {
const data = _interopRequireDefault(require("../../../error/abstract-error"));
_abstractError = function () {
return data;
};
return data;
}
class FailedLoadForTag extends _abstractError().default {
constructor(componentsWithRelativePaths, componentsWithFilesNotDir) {
super();
(0, _defineProperty2().default)(this, "componentsWithRelativePaths", void 0);
(0, _defineProperty2().default)(this, "componentsWithFilesNotDir", void 0);
this.componentsWithRelativePaths = componentsWithRelativePaths;
this.componentsWithFilesNotDir = componentsWithFilesNotDir;
}
getErrorMessage() {
return this.getRelativePathsErrorOutput() + this.getCompWithFilesErrorOutput();
}
getRelativePathsErrorOutput() {
if (!this.componentsWithRelativePaths.length) return '';
const components = this.componentsWithRelativePaths.join(', ');
const title = `the following component(s) use relative paths to require other components.
replace to module paths or use "bit link --rewire" to replace.`;
return `${title}\n${_chalk().default.bold(components)}\n`;
}
getCompWithFilesErrorOutput() {
if (!this.componentsWithFilesNotDir.length) return '';
const components = this.componentsWithFilesNotDir.join(', ');
const title = `\nthe following component(s) don't have a dedicated directory, instead, the files are spread across multiple directories.
refactor these components by moving the component files into one directory or use "bit move <component-id> <directory> --component" to do it for you.`;
return `${title}\n${_chalk().default.bold(components)}`;
}
}
exports.FailedLoadForTag = FailedLoadForTag;