New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

read-workspaces

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-workspaces

Read all package.json files in a workspace

latest
Source
npmnpm
Version
1.2.2
Version published
Weekly downloads
9.8K
-14.01%
Maintainers
1
Weekly downloads
 
Created
Source

read-workspaces

Resolves all package.json files of a workspace setup.

Supports both npm / yarn style workspace definitions and pnpm style.

npm version npm downloads neostandard javascript style Module type: ESM Types in JS Follow @voxpelli@mastodon.social

Usage

Simple

import { readWorkspaces } from 'read-workspaces';

for await (const { cwd, pkg, workspace } = readWorkspaces()) {
  // ...
}

API

readWorkspaces([options])

  • options.cwd='.': A string pointing to the path of the module to look up the package.json and installed modules for
  • options.ignorePaths: An array of strings, string[], with paths to ignore during the lookup of workspaces
  • options.includeWorkspaceRoot=true: When set to false the workspace root will not be returned. Equivalent to npm --include-workspace-root but with different default.
  • options.skipWorkspaces: When set to true, no workspace lookup will occur. Equivalent to npm --workspaces but with different default.
  • options.workspace: An array of strings, string[], that should either match the name of a workspace or its path / path prefix. Narrows returned workspaces to those matching the provided strings. If a requested workspace can't be found, then an error will be thrown when the generator completes. Equivalent to npm's npm --workspace / npm -w.

Returns

AsyncGenerator that yields the workspace root initially (unless its excluded) and then each matching workspaces

  • cwd: the string path to the workspace / root
  • pkg: the package.json content of the workspace / root
  • workspace: the string name of the workspace (not set on the root)

Used by

Similar modules

  • read-pkg – similar functionality but reads a single package

FAQs

Package last updated on 17 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts