pkg-dir-cli

Find the root directory of an npm package


Keywords
cli-app, cli, package, json, root, npm, entry, find, up, find-up, findup, look-up, look, file, search, match, resolve, parent, parents, folder, directory, walk, walking, path
License
MIT
Install
npm install pkg-dir-cli@4.0.0

Documentation

pkg-dir-cli

Find the root directory of a Node.js project or npm package

Install

npm install --global pkg-dir-cli

Usage

$ pkg-dir --help

  Usage
    $ pkg-dir <cwd>

  Examples
    $ echo $PWD
    /Users/sindresorhus/foo/bar
    $ pkg-dir
    /Users/sindresorhus/foo

Example

/
└── Users
    └── sindresorhus
        └── foo
            ├── package.json
            └── bar
                └── example.js
$ echo $PWD
/Users/sindresorhus/foo/bar
$ pkg-dir
/Users/sindresorhus/foo
  • pkg-dir - API for this module
  • find-up-cli - Find a file by walking up parent directories