@netlify/build-info
Version:
Build info utility
33 lines (32 loc) • 1.41 kB
TypeScript
import type { PackageJson } from 'read-pkg';
import { FrameworkName } from '../frameworks/index.js';
import { Project } from '../project.js';
export type WorkspacePackage = {
path: string;
name?: string;
/** For some workspaces like Nx Integrated the build system is aware of the framework */
forcedFramework?: FrameworkName;
};
export declare class WorkspaceInfo {
/** if we are in the current workspace root or not */
isRoot: boolean;
/** the workspace root directory */
rootDir: string;
/** list of relative package paths inside the workspace */
packages: WorkspacePackage[];
/** Detects if a workspace has a sub package */
hasPackage(relativePackagePath: string): boolean;
getPackage(relativePackagePath: string): WorkspacePackage | undefined;
}
/**
* Get a list of globs about all the packages inside a pnpm workspace
* https://pnpm.io/pnpm-workspace_yaml
*/
export declare function detectPnpmWorkspaceGlobs(project: Project): Promise<string[]>;
/** Get the workspace globs from the package.json file */
export declare function detectNpmOrYarnWorkspaceGlobs(pkgJSON: PackageJson): Promise<string[]>;
/**
* If it's a javascript workspace (npm, pnpm, yarn) it will retrieve a list of all
* package paths and will indicate if it's the root of the workspace
*/
export declare function detectWorkspaces(project: Project): Promise<WorkspaceInfo | null>;