vvc
Version:
Vivocha Command Line Tools
24 lines • 890 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const semver = require("semver");
const config_1 = require("./config");
const ws_1 = require("./ws");
async function checkLoginAndVersion() {
const config = await config_1.read().catch(err => {
throw 'Config file not found, perform a login to create it';
});
const info = await ws_1.ws('reflect/cli').catch(err => {
if (err.response && err.response.statusCode === 401) {
throw 'Not logged in';
}
else {
throw err;
}
});
if (info.minVersion && semver.lt(config_1.meta.version, info.minVersion)) {
throw `Incompatible CLI version: please upgrade the Vivocha CLI to version ${info.minVersion} at least`;
}
config.info = info;
}
exports.checkLoginAndVersion = checkLoginAndVersion;
//# sourceMappingURL=startup.js.map