/dependency-package-path

Given a package identifier of a dependency, find path to the package.json

Primary LanguageJavaScriptMIT LicenseMIT

dependency-package-path

Find where a dependency is stored - either in node_modules below the package, or "hoisted" above. Returns the directory hosting package.json.

Usage

npx dependency-package-path [options]

Get path to package.json for identified dependency

Options

  • -w --working-path <path> Working path for node package to examine (default: .)

dependency-package-path - v1.0.0

Index

Functions

Functions

dependencyPath

dependencyPath(key: string, cwd: string): string

Defined in index.ts:9

Get the path to a node dependency, traversing up the tree as expected

internal

Parameters:

Name Type Default Description
key string - Identifier of the node package to find
cwd string process.cwd() Context for working directory (changes with recursive calls)

Returns: string