workspace-tools
Version:
A collection of utilities that are useful in a git-controlled monorepo managed by one of these tools:
25 lines (24 loc) • 1.18 kB
TypeScript
import { WorkspaceManager } from "./WorkspaceManager";
/**
* 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."
*
* @param cwd Start searching from here
* @param preferredManager Search for only this manager's config file
*
* @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).
*/
export declare function getWorkspaceRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;
/**
* Get the root directory of a monorepo, defined as the directory where the workspace manager
* config file is located.
*
* @param cwd Start searching from here
* @param preferredManager Search for only this manager's config file
*/
export declare function getWorkspaceManagerRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;