"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeABIVersion = exports.getServerCommit = void 0;
const tslib_1 = require("tslib");
const core_utils_1 = require("./core-utils");
const logger_1 = require("./logger");
function getServerCommit() {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        try {
            const tag = yield (0, core_utils_1.execPromise2)('[ ! -d .git ] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true', { stdio: [0, 1, 2] });
            if (tag)
                return tag.replace(/^v/, '');
        }
        catch (err) {
            logger_1.logger.debug('Cannot get version from git tags.', { err });
        }
        try {
            const version = yield (0, core_utils_1.execPromise)('[ ! -d .git ] || git rev-parse --short HEAD');
            if (version)
                return version.toString().trim();
        }
        catch (err) {
            logger_1.logger.debug('Cannot get version from git HEAD.', { err });
        }
        return '';
    });
}
exports.getServerCommit = getServerCommit;
function getNodeABIVersion() {
    const version = process.versions.modules;
    return parseInt(version);
}
exports.getNodeABIVersion = getNodeABIVersion;
//# sourceMappingURL=version.js.map