@techor/query-workspaces
TypeScript icon, indicating that this package has built-in type declarations

2.4.6 • Public • Published

Query workspaces with package.json

NPM Version NPM Version NPM package ( download / month ) Follow @mastercorg Github release actions


  • 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/**']
}

NPM Version

Package Sidebar

Install

npm i @techor/query-workspaces

Homepage

aron.tw

Weekly Downloads

6

Version

2.4.6

License

MIT

Unpacked Size

11.5 kB

Total Files

7

Last publish

Collaborators

  • 1aron