Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ temp/
**/__fixtures__/*/.yarn/cache/
install-state.gz
/package-lock.json
!**/__fixtures__/**/package-lock.json
!**/__fixtures__/**/package-lock.json
.claude/settings.local.json
11 changes: 11 additions & 0 deletions change/change-1c33b953-d911-4dbe-ac9d-9af7da0d5df1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"type": "patch",
"comment": "Deprecate `getWorkspaces` and rename to `getWorkspaceInfos` (same with async version)",
"packageName": "workspace-tools",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
}
]
}
14 changes: 10 additions & 4 deletions packages/workspace-tools/etc/workspace-tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ export function getUserEmail(options: GitCommonOptions): string | null;
// @public @deprecated (undocumented)
export function getUserEmail(cwd: string): string | null;

// @public
export function getWorkspaceInfos(cwd: string): WorkspaceInfos;

// @public
export function getWorkspaceInfosAsync(cwd: string): Promise<WorkspaceInfos>;

// Warning: (ae-forgotten-export) The symbol "WorkspaceManager" needs to be exported by the entry point index.d.ts
//
// @public
Expand All @@ -354,11 +360,11 @@ export function getWorkspacePackagePathsAsync(cwd: string): Promise<string[]>;
// @public @deprecated
export function getWorkspaceRoot(cwd: string, preferredManager?: WorkspaceManager): string | undefined;

// @public
export function getWorkspaces(cwd: string): WorkspaceInfos;
// @public @deprecated (undocumented)
export const getWorkspaces: typeof getWorkspaceInfos;

// @public
export function getWorkspacesAsync(cwd: string): Promise<WorkspaceInfos>;
// @public @deprecated (undocumented)
export const getWorkspacesAsync: typeof getWorkspaceInfosAsync;

// @public @deprecated (undocumented)
export function getYarnWorkspaceRoot(cwd: string): string;
Expand Down
7 changes: 6 additions & 1 deletion packages/workspace-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ export type { PackageDependency, PackageGraph } from "./types/PackageGraph";
export type { PackageInfo, PackageInfos } from "./types/PackageInfo";
export type { WorkspacePackageInfo, WorkspaceInfos, WorkspaceInfo } from "./types/WorkspaceInfo";
export { findWorkspacePath } from "./workspaces/findWorkspacePath";
export { getWorkspaces, getWorkspacesAsync } from "./workspaces/getWorkspaces";
export {
getWorkspaces,
getWorkspacesAsync,
getWorkspaceInfos,
getWorkspaceInfosAsync,
} from "./workspaces/getWorkspaces";
export { getWorkspacePackagePaths, getWorkspacePackagePathsAsync } from "./workspaces/getWorkspacePackagePaths";
export { getWorkspaceManagerRoot, getWorkspaceRoot } from "./workspaces/getWorkspaceRoot";
export { getPackageInfo, getPackageInfoAsync } from "./getPackageInfo";
Expand Down
10 changes: 8 additions & 2 deletions packages/workspace-tools/src/workspaces/getWorkspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import type { WorkspaceInfos } from "../types/WorkspaceInfo";
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
* workspace/monorepo manager's config file.
*/
export function getWorkspaces(cwd: string): WorkspaceInfos {
export function getWorkspaceInfos(cwd: string): WorkspaceInfos {
const utils = getWorkspaceUtilities(cwd);
return utils?.getWorkspaces(cwd) || [];
}

/** @deprecated Use `getWorkspaceInfos` */
export const getWorkspaces = getWorkspaceInfos;

/**
* Get an array with names, paths, and package.json contents for each package ("workspace" in
* npm/yarn/pnpm terms) within a monorepo. The list of included packages is based on the
Expand All @@ -19,7 +22,7 @@ export function getWorkspaces(cwd: string): WorkspaceInfos {
* NOTE: As of writing, this will start promises to read all package.json files in parallel,
* without direct concurrency control.
*/
export async function getWorkspacesAsync(cwd: string): Promise<WorkspaceInfos> {
export async function getWorkspaceInfosAsync(cwd: string): Promise<WorkspaceInfos> {
const utils = getWorkspaceUtilities(cwd);

if (!utils) {
Expand All @@ -33,3 +36,6 @@ export async function getWorkspacesAsync(cwd: string): Promise<WorkspaceInfos> {

return utils.getWorkspacesAsync(cwd);
}

/** @deprecated Use `getWorkspaceInfosAsync` */
export const getWorkspacesAsync = getWorkspaceInfosAsync;