UNPKG

workspace-tools

Version:

A collection of utilities that are useful in a git-controlled monorepo managed by one of these tools:

35 lines (34 loc) 1.42 kB
import type { Catalogs } from "../../types/Catalogs"; import type { WorkspaceInfos } from "../../types/WorkspaceInfo"; export interface WorkspaceUtilities { /** * Get an array of paths to packages ("workspaces") in the monorepo, based on the * manager's config file. */ getWorkspacePackagePaths: (cwd: string) => string[]; /** * Get an array of paths to packages ("workspaces") in the monorepo, based on the * manager's config file. */ getWorkspacePackagePathsAsync?: (cwd: string) => Promise<string[]>; /** * Get an array with names, paths, and package.json contents for each package ("workspace") * in a monorepo. */ getWorkspaces: (cwd: string) => WorkspaceInfos; /** * Get an array with names, paths, and package.json contents for each package ("workspace") * in a monorepo. */ getWorkspacesAsync: (cwd: string) => Promise<WorkspaceInfos>; /** * Get version catalogs, if supported by the manager (only pnpm and yarn v4 as of writing). */ getCatalogs?: (cwd: string) => Catalogs | undefined; } /** * Get utility implementations for the workspace manager of `cwd`. * It will search up from `cwd` to find a manager file and workspace root, with caching. * Returns undefined if the manager can't be determined. */ export declare function getWorkspaceUtilities(cwd: string): WorkspaceUtilities | undefined;