• Infers the package manager to be used based on the provided options and environment.

    This function determines the package manager in the following order of precedence:

    1. Uses the package manager specified in the options, if valid.
    2. Infers the package manager from the user agent string.
    3. Infers the package manager used for the global CLI installation.
    4. Defaults to 'npm' if no other method succeeds.

    Parameters

    • optionsPackageManager: undefined | string

      The package manager specified in the options (if any).

    • env: ProcessEnv = process.env

    Returns PackageManager

    The inferred package manager as a PackageManager type.