"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const lru_cache_1 = __importDefault(require("lru-cache"));
let _hasYarn;
const _yarnProjects = new lru_cache_1.default({
    max: 10,
    maxAge: 1000,
});
let _hasGit;
const _gitProjects = new lru_cache_1.default({
    max: 10,
    maxAge: 1000,
});
exports.hasGit = () => {
    if (process.env.VUE_CLI_TEST) {
        return true;
    }
    if (_hasGit != null) {
        return _hasGit;
    }
    try {
        child_process_1.execSync('git --version', { stdio: 'ignore' });
        return (_hasGit = true);
    }
    catch (e) {
        return (_hasGit = false);
    }
};
exports.hasProjectGit = (cwd) => {
    if (_gitProjects.has(cwd)) {
        return _gitProjects.get(cwd);
    }
    let result;
    try {
        child_process_1.execSync('git status', { stdio: 'ignore', cwd });
        result = true;
    }
    catch (e) {
        result = false;
    }
    _gitProjects.set(cwd, result);
    return result;
};
// OS
exports.isWindows = process.platform === 'win32';
exports.isMacintosh = process.platform === 'darwin';
exports.isLinux = process.platform === 'linux';
//# sourceMappingURL=env.js.map