"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const supi_1 = require("supi");
const createStoreController_1 = require("../createStoreController");
const findWorkspacePackages_1 = require("../findWorkspacePackages");
async function uninstallCmd(input, opts) {
    const store = await createStoreController_1.default(opts);
    const uninstallOpts = Object.assign(opts, {
        store: store.path,
        storeController: store.ctrl,
    });
    if (opts.lockfileDirectory === opts.prefix) {
        return supi_1.uninstall(input, uninstallOpts);
    }
    uninstallOpts['localPackages'] = opts.linkWorkspacePackages && opts.workspacePrefix
        ? findWorkspacePackages_1.arrayOfLocalPackagesToMap(await findWorkspacePackages_1.default(opts.workspacePrefix))
        : undefined;
    return supi_1.mutateModules([
        {
            bin: opts.bin,
            dependencyNames: input,
            mutation: 'uninstallSome',
            prefix: opts.prefix,
        },
    ], uninstallOpts);
}
exports.default = uninstallCmd;
//# sourceMappingURL=uninstall.js.map