@manypkg/get-packages
> A simple utility to get the packages from a monorepo, whether they're using Yarn, Bolt, Lerna, pnpm or Rush
Last updated 5 months ago by manypkg-release-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @manypkg/get-packages 
SYNC missed versions from official npm registry.

@manypkg/get-packages

A simple utility to get the packages from a monorepo, whether they're using Yarn, Bolt, Lerna, pnpm or Rush

This library exports getPackages and getPackagesSync. It is intended mostly for use of developers building tools that want to support different kinds of monorepos as an easy way to write tools without having to write tool-specific code. It supports Yarn, Bolt, Lerna, pnpm, Rush and single-package repos(where the only package is the the same as the root package). This library uses @manypkg/find-root to search up from the directory that's passed to getPackages or getPackagesSync to find the project root.

import { getPackages, getPackagesSync } from "@manypkg/get-packages";

const { tool, packages, rootPackage, rootDir } = await getPackages(process.cwd());
const { tool, packages, rootPackage, rootDir } = getPackagesSync(process.cwd());

// From @manypkg/tools

interface Tool {
    readonly type: string;
    isMonorepoRoot(directory: string): Promise<boolean>;
    isMonorepoRootSync(directory: string): boolean;
    getPackages(directory: string): Promise<Packages>;
    getPackagesSync(directory: string): Packages;
}

interface Package {
    packageJson: PackageJSON;
    dir: string;
    relativeDir: string;
}

interface Packages {
  tool: Tool;
  packages: Package[];
  rootPackage?: Package;
  rootDir: string;
}

Current Tags

  • 2.2.2                                ...           latest (5 months ago)

11 Versions

  • 2.2.2                                ...           5 months ago
  • 2.2.1                                ...           8 months ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE