Function getWorkspaceRoot

  • Get the root directory of a monorepo, defined as the directory where the workspace manager config file is located.

    NOTE: "Workspace" here refers to the entire project, not an individual package the way it does in e.g. npm/yarn/pnpm "workspaces."

    Parameters

    • cwd: string

      Start searching from here

    • Optional preferredManager: WorkspaceManager

      Search for only this manager's config file

    Returns string | undefined

    Deprecated

    Renamed to getWorkspaceManagerRoot to align "workspace" terminology with npm/yarn/pnpm. In most cases, you should use findProjectRoot instead since it falls back to the git root if no workspace manager is found (single-package projects).