alwaysai
Version:
The alwaysAI command-line interface (CLI)
30 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkConfigFileExistsAndValid = void 0;
const app_check_component_1 = require("../components/app/app-check-component");
const echo_1 = require("./echo");
const log_config_error_messages_1 = require("./log-config-error-messages");
const logSymbols = require("log-symbols");
const stringify_error_1 = require("./stringify-error");
const logger_1 = require("./logger");
async function checkConfigFileExistsAndValid(configFile) {
let configExistsAndReadable = true;
if (configFile.exists()) {
try {
configFile.read();
}
catch (error) {
logger_1.logger.error((0, stringify_error_1.stringifyError)(error));
configExistsAndReadable = false;
const errorMessage = await (0, log_config_error_messages_1.logConfigFileErrorMessages)(configFile, app_check_component_1.InvalidFilePleaseRunAppConfigureMessage);
(0, echo_1.echo)(`${logSymbols.error} ${errorMessage}`);
}
}
else {
await (0, log_config_error_messages_1.logConfigFileErrorMessages)(configFile, app_check_component_1.MissingFilePleaseRunAppConfigureMessage);
configExistsAndReadable = false;
}
return configExistsAndReadable;
}
exports.checkConfigFileExistsAndValid = checkConfigFileExistsAndValid;
//# sourceMappingURL=config-file-exists-and-is-valid.js.map