"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.doBasicInstallAsync = doBasicInstallAsync;
const InstallManagerFactory_1 = require("../InstallManagerFactory");
const SetupChecks_1 = require("../SetupChecks");
const PurgeManager_1 = require("../PurgeManager");
const VersionMismatchFinder_1 = require("../versionMismatch/VersionMismatchFinder");
async function doBasicInstallAsync(options) {
    const { rushConfiguration, rushGlobalFolder, isDebug, variant, terminal, beforeInstallAsync, afterInstallAsync, subspace } = options;
    VersionMismatchFinder_1.VersionMismatchFinder.ensureConsistentVersions(rushConfiguration, terminal, {
        variant,
        subspace
    });
    SetupChecks_1.SetupChecks.validate(rushConfiguration);
    const purgeManager = new PurgeManager_1.PurgeManager(rushConfiguration, rushGlobalFolder);
    const installManager = await InstallManagerFactory_1.InstallManagerFactory.getInstallManagerAsync(rushConfiguration, rushGlobalFolder, purgeManager, {
        debug: isDebug,
        allowShrinkwrapUpdates: false,
        checkOnly: false,
        bypassPolicy: false,
        noLink: false,
        fullUpgrade: false,
        recheckShrinkwrap: false,
        offline: false,
        collectLogFile: false,
        pnpmFilterArgumentValues: [],
        selectedProjects: new Set(rushConfiguration.projects),
        maxInstallAttempts: 1,
        networkConcurrency: undefined,
        subspace,
        terminal,
        variant,
        afterInstallAsync,
        beforeInstallAsync
    });
    try {
        await installManager.doInstallAsync();
    }
    finally {
        await purgeManager.startDeleteAllAsync();
    }
}
//# sourceMappingURL=doBasicInstallAsync.js.map