"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, /**
 * nvu teardown
 *
 * Remove nvu binaries from ~/.nvu/bin
 */ "default", {
    enumerable: true,
    get: function() {
        return teardownCmd;
    }
});
var _exitcompat = /*#__PURE__*/ _interop_require_default(require("exit-compat"));
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
var _fsremovecompat = require("fs-remove-compat");
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
var _constantsts = require("../constants.js");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
function teardownCmd(_args) {
    var binDir = _path.default.join(_constantsts.storagePath, 'bin');
    var binaries = [
        'node',
        'npm',
        'npx'
    ];
    var ext = isWindows ? '.exe' : '';
    var removed = 0;
    for(var i = 0; i < binaries.length; i++){
        var binaryPath = _path.default.join(binDir, binaries[i] + ext);
        if (_fs.default.existsSync(binaryPath)) {
            (0, _fsremovecompat.rmSync)(binaryPath, {
                force: true
            });
            removed++;
        }
    }
    if (removed > 0) {
        console.log("Removed ".concat(removed, " binary(s) from ").concat(binDir));
        console.log('');
        console.log('You may also want to remove ~/.nvu/bin from your PATH.');
    } else {
        console.log('No binaries found to remove.');
    }
    (0, _exitcompat.default)(0);
}
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }