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
110 lines (81 loc) • 2.38 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 _defineProperty2() {
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
_defineProperty2 = function () {
return data;
};
return data;
}
function _ramda() {
const data = _interopRequireDefault(require("ramda"));
_ramda = function () {
return data;
};
return data;
}
function _diagnosis() {
const data = _interopRequireDefault(require("../diagnosis"));
_diagnosis = function () {
return data;
};
return data;
}
function _consumer() {
const data = require("../../consumer");
_consumer = function () {
return data;
};
return data;
}
function _workspaceConfig() {
const data = _interopRequireDefault(require("../../consumer/config/workspace-config"));
_workspaceConfig = function () {
return data;
};
return data;
}
class ValidateWorkspaceBitJsonSyntax extends _diagnosis().default {
constructor(...args) {
super(...args);
(0, _defineProperty2().default)(this, "name", "validate workspace's bit config");
(0, _defineProperty2().default)(this, "description", 'validate workspace configuration object');
(0, _defineProperty2().default)(this, "category", 'configuration');
}
_formatSymptoms(bareResult) {
const bitJsonPath = _ramda().default.path(['data', 'bitJsonPath'], bareResult);
return `invalid bit.json: ${bitJsonPath} is not a valid JSON file.`;
}
_formatManualTreat() {
return 'manually fix the bit.json or consider running bit init --reset to recreate the file';
} // TODO: support configuration from package.json
_runExamine() {
return (0, _bluebird().coroutine)(function* () {
const consumer = yield (0, _consumer().loadConsumer)();
const consumerPath = consumer.getPath();
try {
yield _workspaceConfig().default.loadIfExist(consumerPath);
return {
valid: true
};
} catch (e) {
return {
valid: false,
data: {}
};
}
})();
}
}
exports.default = ValidateWorkspaceBitJsonSyntax;
;