1.0.11 • Published 5 months ago

get-workspaces v1.0.11

Weekly downloads
9,443
License
MIT
Repository
github
Last release
5 months ago

Get Workspaces

A simple utility to get workspaces, whether they be yarn or bolt.

This library exports a very simple function that looks at a package.json, and generates the glob of accepted workspaces from the workspaces field. It is intended mostly for use of developers building tools that want to support both kinds of mono-repos as an easy way to write tools for both.

import getWorkspaces from "get-workspaces";

const workspaces = await getWorkspaces();

Workspaces have the shape:

{
    name // The name from the package.json
    config // The package.json of the package
    dir // The directory of the package
}

Config

We assume the function is being run from a directory with the package.json you want to target, however you can pass in a working directory if you want. In addition, you can change what tools the package will scan for.

const workspaces = await getWorkspaces({ cwd, tools });

The tools supported are yarn, bolt, pnpm and root, which returns the root package as a single workspace if passed. Tools is an array, so you can try for one type of workspace and then another, so you could do:

getWorkspaces({ tools: ["bolt", "yarn", "pnpm", "root"] });
1.0.11

5 months ago

1.0.10

1 year ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6-temp.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.6.0

4 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago