Socket
Socket
Sign inDemoInstall

@lerna/package-graph

Package Overview
Dependencies
3
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lerna/package-graph


Version published
Maintainers
2
Install size
493 kB
Created

Package description

What is @lerna/package-graph?

@lerna/package-graph is a utility for managing and analyzing the dependency graph of packages within a monorepo. It helps in understanding the relationships between different packages and can be used to perform operations like finding dependencies, dependents, and traversing the graph.

What are @lerna/package-graph's main functionalities?

Creating a Package Graph

This feature allows you to create a graph of packages from an array of package objects. The graph can then be used to analyze the relationships between the packages.

const { PackageGraph } = require('@lerna/package-graph');
const packages = [
  { name: 'package-a', version: '1.0.0', dependencies: { 'package-b': '^1.0.0' } },
  { name: 'package-b', version: '1.0.0', dependencies: {} }
];
const graph = new PackageGraph(packages);
console.log(graph);

Finding Package Dependencies

This feature allows you to find the dependencies of a specific package within the graph. In this example, it retrieves the dependencies of 'package-a'.

const { PackageGraph } = require('@lerna/package-graph');
const packages = [
  { name: 'package-a', version: '1.0.0', dependencies: { 'package-b': '^1.0.0' } },
  { name: 'package-b', version: '1.0.0', dependencies: {} }
];
const graph = new PackageGraph(packages);
const packageA = graph.get('package-a');
console.log(packageA.localDependencies);

Finding Package Dependents

This feature allows you to find the dependents of a specific package within the graph. In this example, it retrieves the dependents of 'package-b'.

const { PackageGraph } = require('@lerna/package-graph');
const packages = [
  { name: 'package-a', version: '1.0.0', dependencies: { 'package-b': '^1.0.0' } },
  { name: 'package-b', version: '1.0.0', dependencies: {} }
];
const graph = new PackageGraph(packages);
const packageB = graph.get('package-b');
console.log(packageB.localDependents);

Other packages similar to @lerna/package-graph

Changelog

Source

3.13.0 (2019-02-15)

Features

  • conventional-commits: Bump conventional-changelog dependencies to pick up security fixes (d632d1b)
  • listable: Output newline-delimited JSON with --ndjson (742781b)
  • meta: Add repository.directory field to package.json (aec5023)
  • meta: Normalize package.json homepage field (abeb4dc)

Readme

Source

@lerna/package-graph

Lerna's internal representation of a package graph

Usage

You probably shouldn't, at least directly.

Install lerna for access to the lerna CLI.

Keywords

FAQs

Last updated on 15 Feb 2019

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc