Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@manypkg/get-packages

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@manypkg/get-packages

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

  • 2.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
increased by24.51%
Maintainers
0
Weekly downloads
 
Created
Source

@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;
}

FAQs

Package last updated on 27 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc