Find all the workspaces of a monorepo.
npm install find-workspacesFind all the workspaces of a monorepo.
It supports:
- Yarn workspaces
- npm workspaces
- pnpm workspaces
- lerna
- bolt
``shnpm
npm i find-workspaces
Usage
`javascript
// esm
import { findWorkspaces } from "find-workspaces";
// commonjs
const { findWorkspaces } = require("find-workspaces");const workspaces = findWorkspaces();
console.log(workspaces);
`API
$3
Finds all workspaces.
Returns [
Workspace[]](#workspace) or null if dirname is not inside a monorepo.#### dirname
Type:
string | undefined
Default: process.cwd()The directory to start searching for the monorepo root.
#### Options
Type:
Options
Default: {}Options$3
WorkspacesRoot or null if dirname is not inside a monorepo.#### dirname
Type:
string | undefined
Default: process.cwd()The directory to start searching for the monorepo root.
#### Options
Type:
Options
Default: {}Options$3
findWorkspaces and findWorkspacesRoot.$3
#### stopDir
Type:
string | undefined
Default: os.homedir()The directory to stop searching for the monorepo root.
The provided directory will not be included in the search.
#### cache
Type:
Cache | undefinedcreateWorkspacesCache.$3
#### location
Type:
stringThe location of the workspace as an absolute path.
#### package
PackageJsonThe parsed
package.json file of the workspace.$3
#### location
Type:
stringThe location of the workspace as an absolute path.
#### globs
Type:
string[]`A list of the glob patterns used to define the workspaces.