// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { ShrinkwrapFileFactory } from '../ShrinkwrapFileFactory';
/**
 *  A policy that validates shrinkwrap files used by package managers.
 */
export function validate(rushConfiguration, subspace, variant, options) {
    // eslint-disable-next-line no-console
    console.log('Validating package manager shrinkwrap file.\n');
    const shrinkwrapFile = ShrinkwrapFileFactory.getShrinkwrapFile({
        packageManager: rushConfiguration.packageManager,
        shrinkwrapFilePath: subspace.getCommittedShrinkwrapFilePath(variant),
        subspaceHasNoProjects: subspace.getProjects().length === 0
    });
    if (!shrinkwrapFile) {
        // eslint-disable-next-line no-console
        console.log('Shrinkwrap file could not be found, skipping validation.\n');
        return;
    }
    // Run shrinkwrap-specific validation
    shrinkwrapFile.validate(rushConfiguration.packageManagerOptions, {
        ...options,
        repoState: subspace.getRepoState()
    }, rushConfiguration.experimentsConfiguration.configuration);
}
//# sourceMappingURL=ShrinkwrapFilePolicy.js.map