Function getPackageInfosAsync

  • Read all the package.json files in a monorepo and return a mapping from package name to info. Only works for monorepos which use a supported workspace/monorepo manager.

    Notes:

    • WARNING: As of writing, this will start promises to read all package.json files in parallel, without direct concurrency control.
    • The workspace manager, root, and list of package paths for cwd are cached internally, but the package contents are not.
    • To get an array listing package names, paths, and contents, use getWorkspaceInfos instead.

    Parameters

    • cwd: string

      Start looking for the manager config from here

    • Optional managerOverride: WorkspaceManager

      Workspace/monorepo manager to use instead of auto-detecting

    Returns Promise<PackageInfos>

    Mapping from package name to package info. If no workspace config is found, it will return info for the root package.json if one exists. Will be empty on error (it logs verbose warnings instead of throwing).