@veecode-platform/safira-cli
Version:
Generate a microservice project from your spec.
25 lines (24 loc) • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DoctorNode = void 0;
const tslib_1 = require("tslib");
const version_utils_1 = require("../utils/version-utils");
const properties = tslib_1.__importStar(require("../properties.json"));
const command_execute_1 = require("../command/command-execute");
class DoctorNode {
async execute() {
return command_execute_1.CommandExecute.instance.exec("node --version", false).then(stdout => {
if (stdout) {
const nodeVersion = version_utils_1.VersionUtils.extractVersion(stdout, /\d+(\.\d+){2,}/);
if (version_utils_1.VersionUtils.compareVersions(nodeVersion, properties.requirements.node.minimal) >= 0) {
return ("Node is healthy, Version installed " + nodeVersion);
}
throw new Error(`Node is not healthy, Version installed ${nodeVersion}, to adjust this update to version ${properties.requirements.node.minimal}`);
}
throw new Error("Node is not installed");
}).catch(error => {
throw new Error("Node is not installed");
});
}
}
exports.DoctorNode = DoctorNode;