A collection of utilities that are useful in a git-controlled monorepo managed by one of these tools:
Set to any value to log output for all git commands.
Override the maxBuffer value for git processes, for example if the repo is very large. workspace-tools uses 500MB by default.
Sometimes if multiple workspace/monorepo manager files are checked in, it's necessary to hint which manager is used: npm, yarn, pnpm, rush, or lerna. Some APIs also accept a manager parameter, which is now the preferred method when available.
Log additional output from certain functions.
For details of changes in all versions, see the changelog. This only lists the most significant breaking API changes.
The following APIs have been renamed for clarity, removed entirely, or consolidated:
| Old (removed) | New |
|---|---|
getWorkspaces |
getWorkspaceInfos |
getWorkspacesAsync |
getWorkspaceInfosAsync |
WorkspaceInfo |
WorkspaceInfos |
getWorkspaceRoot |
getWorkspaceManagerRoot |
listOfWorkspacePackageNames |
workspaces.map(w => w.name) |
getPnpmWorkspaceRoot |
getWorkspaceManagerRoot(cwd, 'pnpm') |
getRushWorkspaceRoot |
getWorkspaceManagerRoot(cwd, 'rush') |
getYarnWorkspaceRoot |
getWorkspaceManagerRoot(cwd, 'yarn') |
getPnpmWorkspaces |
getWorkspaceInfos(cwd, 'pnpm') |
getRushWorkspaces |
getWorkspaceInfos(cwd, 'rush') |
getYarnWorkspaces |
getWorkspaceInfos(cwd, 'yarn') |
Other changes:
string[] | undefined instead of returning an empty array on error:getAllPackageJsonFiles, getAllPackageJsonFilesAsyncgetWorkspacePackagePaths, getWorkspacePackagePathsAsyncgetWorkspaceInfos, getWorkspaceInfosAsyncgetWorkspaceManagerAndRoot is now exported if you want to know the manager as well as the rootmanager param to force using a specific manager:getWorkspaceManagerRootfindProjectRoot (falls back to the git root and throws if neither is found)getWorkspacePackagePaths, getWorkspacePackagePathsAsyncgetWorkspacePatterns (new)getWorkspaceInfos, getWorkspaceInfosAsyncgetCatalogs