Skip to content

Function: workspaceOf()

Documentation / @wtf/project-resolve / workspace / workspaceOf

function workspaceOf(folder, __namedParameters): Promise<Workspace | undefined>;

Defined in: packages/project-resolve/src/workspace.ts:607

The workspace that folder is in: of the nearest folder from folder up whose pnpm-workspace.yaml, or whose package.json’s workspaces, makes one that holds it. A workspace holds a folder when the project the folder is in — the nearest folder from it up with a package.json — is its root, or one of its packages, as a package manager reads it. A folder of a project of its own, in a workspace that does not name it, or of a package in node_modules, is in no workspace of that root: the one of a folder above, if one holds it, else undefined. Throws a WorkspaceError of ./errors when a file it reads says no workspace, and an UnreadableWorkspaceError when a pnpm-workspace.yaml it reads is there and cannot be read.

Parameters

ParameterType
folderstring
__namedParametersWorkspaceOptions

Returns

Promise<Workspace | undefined>