This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

packages-list
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

packages-list

List all packages in a monorepo.

npm package License Quality

Contents

Introduction

Lists all packages in a monorepo.

Includes directory, name, and contents of package.json. Order is non-deterministic.

Can be called from any location inside a monorepo.

Supported Package Managers

Package managers that are supported for finding/parsing packages are:

Install

npm i packages-list

Example

Given file structure

/
└─┬ packages
  ├─┬ my-package-a
  │ └── package.json
  ├─┬ my-package-b
  │ └── package.json
  └─┬ my-package-c
    └── package.json
import { listPackages } from 'packagesList';

const packages = await listPackages();

console.log(packages);
// [
//     {
//         "directory": "/packages/my-package-a",
//         "name": "my-package-a",
//         "packageJson": { "name": "my-package-a" }
//     },
//     {
//         "directory": "/packages/my-package-b",
//         "name": "my-package-b",
//         "packageJson": { "name": "my-package-b" }
//     },
//     {
//         "directory": "/packages/my-package-c",
//         "name": "my-package-c",
//         "packageJson": { "name": "my-package-c" }
//     }
// ]

Usage

packages-list is an ESM module. That means it must be imported. To load from a CJS module, use dynamic import const { listPackages } = await import('packages-list');.

API

listPackages(options?)

Returns a promise that resolves to an array of packages. Every package contains:

{
    "directory": "string",
    "name": "string",
    "packageJson": { "name": "string", "version": "..." }
}

options

  • cwd

    • Type: string or URL
    • optional, defaults to process.cwd()
    • Directory to use as base directory.
    • See parse-cwd.
  • manager

    • Specify package manager to use
    • 'lerna' | 'npm' | 'nx' | 'rush' | 'yarn'
    • If omitted, will try all and take first found
      • e.g. would use lerna.json to load packages if found, but can be forced to use npm workspaces if manager = 'npm'

Readme

Keywords

Package Sidebar

Install

npm i packages-list

Weekly Downloads

3

Version

1.1.6

License

MIT

Unpacked Size

13.6 kB

Total Files

19

Last publish

Collaborators

  • jacobley