aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins/lib/nots/package_manager/__init__.py
blob: 4bb369ba47911af14111be25d0b7474c2504cacd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import typing

from .base import (
    bundle_node_modules,
    constants,
    extract_node_modules,
    PackageJson,
    utils,
    PackageManagerCommandError,
    BasePackageManager,
    BaseLockfile,
)
from .base.package_json import PackageJsonWorkspaceError
from .pnpm import PnpmPackageManager
from .npm import NpmPackageManager

manager = PnpmPackageManager


def get_package_manager_type(key: typing.Literal["pnpm", "npm"]) -> typing.Type[BasePackageManager]:
    if key == "pnpm":
        return PnpmPackageManager
    if key == "npm":
        return NpmPackageManager
    raise ValueError(f"Invalid package manager key: {key}")


__all__ = [
    "BaseLockfile",
    "BasePackageManager",
    "PnpmPackageManager",
    "NpmPackageManager",
    "PackageJson",
    "PackageJsonWorkspaceError",
    "PackageManagerCommandError",
    "bundle_node_modules",
    "constants",
    "extract_node_modules",
    "get_package_manager_type",
    "manager",
    "utils",
]