@teambit/harmony
Version:
abstract extension system
20 lines • 681 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readConfigFile = readConfigFile;
const comment_json_1 = require("comment-json");
const fs_1 = require("fs");
const read_config_error_1 = require("./exceptions/read-config-error");
function readConfigFile(path, mustExist = true) {
if (!mustExist && !(0, fs_1.existsSync)(path)) {
return {};
}
try {
const json = (0, comment_json_1.parse)((0, fs_1.readFileSync)(path, 'utf8'));
delete json['$schema'];
return json;
}
catch (err) {
throw new read_config_error_1.ReadConfigError(path, err);
}
}
//# sourceMappingURL=config-reader.js.map