"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const supi_1 = require("supi");
const createStoreController_1 = require("../createStoreController");
const readImporterManifest_1 = require("../readImporterManifest");
async function default_1(args, opts, command) {
    const store = await createStoreController_1.default(opts);
    const rebuildOpts = Object.assign(opts, {
        store: store.path,
        storeController: store.ctrl,
    });
    if (args.length === 0) {
        await supi_1.rebuild([
            {
                buildIndex: 0,
                manifest: await readImporterManifest_1.readImporterManifestOnly(rebuildOpts.prefix, opts),
                prefix: rebuildOpts.prefix,
            },
        ], rebuildOpts);
    }
    await supi_1.rebuildPkgs([
        {
            manifest: await readImporterManifest_1.readImporterManifestOnly(rebuildOpts.prefix, opts),
            prefix: rebuildOpts.prefix,
        },
    ], args, rebuildOpts);
}
exports.default = default_1;
