@techor/query-workspaces
v2.4.6
Published
Query workspaces with package.json
Downloads
65
Maintainers
Readme
- By default, read
.workspaces
of package.json in the current working directory - By default, workspaces in node_modules are excluded
Getting Started
npm install @techor/query-workspaces
Preparation
Your monorepo usually looks like this:
.
├── package.json
└── packages
+ ├─── a
│ └─── package.json
+ ├─── b
│ ├─── node_modules
│ │ └─── fake-module
│ │ └─── package.json
+ │ ├─── bb
│ │ └─── package.json
│ └─── package.json
└─── c
./package.json
{
"workspaces": ["packages/**"]
}
Usage
queryWorkspaces(patterns?, options?): string[]
import queryWorkspaces from '@techor/query-workspaces'
const workspaces = queryWorkspaces()
// ['packages/a', 'packages/b', 'packages/b/bb']
const workspaces = queryWorkspaces(['packages/*'])
// ['packages/a', 'packages/b']
Options
Inherited from fast-glob options
{
cwd: process.cwd(),
ignore: ['**/node_modules/**']
}