"use strict";
var _a;
exports.__esModule = true;
exports.zeusCurrentVersion = exports.version = void 0;
var node_child_process_1 = require("node:child_process");
var appUtilPkg = require('zeppos-app-utils/package.json');
var zeusVersion = require('../package.json').version;
var zpmVersion = ((_a = appUtilPkg === null || appUtilPkg === void 0 ? void 0 : appUtilPkg.dependencies) === null || _a === void 0 ? void 0 : _a['@zeppos/zpm']) || '';
function getNodeVersions() {
    try {
        var nodeVersion = (0, node_child_process_1.execSync)('node -v').toString().trim();
        var npmVersion = (0, node_child_process_1.execSync)('npm -v').toString().trim();
        return {
            node: nodeVersion,
            npm: npmVersion
        };
    }
    catch (error) {
        console.error('Error executing commands:', error);
        throw error;
    }
}
function green(str) {
    return "\u001B[32m".concat(str.startsWith('v') ? str : 'v' + str, "\u001B[0m");
}
function version() {
    var versionNum = zpmVersion.replace('^', '');
    var nodeVersion = getNodeVersions();
    return [
        "node: ".concat(green(nodeVersion.node)),
        "npm: ".concat(green(nodeVersion.npm)),
        "zeus: ".concat(green(zeusVersion)),
        "zpm: ".concat(green(versionNum))
    ].join('\n');
}
exports.version = version;
function zeusCurrentVersion() {
    return zeusVersion;
}
exports.zeusCurrentVersion = zeusCurrentVersion;
