PackageAPI Reference
API Reference
Last updated:
API Reference
findMonorepoRoot()
Find monorepo root directory and strategy.
Signature:
function findMonorepoRoot(cwd?: string): Promise<{ path: string; strategy: string } | null>Strategies: pnpm, npm, yarn, lerna, turborepo
findPackageRoot()
Find package root directory.
Signature:
function findPackageRoot(cwd?: string): Promise<{ path: string; strategy: string } | null>findPackageJson()
Find and parse package.json/yaml/json5.
Signature:
function findPackageJson(cwd?: string, options?: Options): Promise<{
packageJson: PackageJson;
path: string;
} | null>Options:
yaml- Enable package.yaml supportjson5- Enable package.json5 supportresolveCatalog- Resolve pnpm catalog dependencies
readPackageJson()
Read and parse package.json file.
Signature:
function readPackageJson(path: string, options?: Options): Promise<PackageJson>detectPackageManager()
Detect which package manager is used.
Signature:
function detectPackageManager(cwd?: string): Promise<"pnpm" | "npm" | "yarn" | null>