Function getWorkspaceInfos

  • Get an array with names, paths, and package.json contents for each package ("workspace" in npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the workspace/monorepo manager's config file.

    Notes:

    • The workspace manager, root, and list of package paths for cwd are cached internally, but the package contents are not.
    • To get an object with package names as keys, use getPackageInfos instead.

    Parameters

    • cwd: string
    • Optional managerOverride: WorkspaceManager

      Workspace/monorepo manager to use instead of auto-detecting

    Returns WorkspaceInfos | undefined

    Array of workspace package infos, or undefined if not found (not a monorepo) or there's any issue. (Logs verbose warnings instead of throwing on error.)