pkg-dir-cli
Find the root directory of a npm package.
The tool provides a command‑line interface for locating the root directory of a Node.js project or npm package. By supplying a current working directory, it walks upward through parent folders until it finds the directory that contains a package.json file, then outputs that path. This behavior mirrors the functionality of the underlying package-directory API, making it usable from shells and scripts without requiring additional code.
Developers who need to resolve the base of a package for build scripts, tooling, or automation can invoke the CLI directly, for example with `package-directory <cwd>` or simply `package-directory` to use the current directory. The command prints the resolved root path, facilitating downstream operations that depend on the package’s location.
The package is distributed as a global npm binary, is marked as stable, and is part of a suite of related utilities such as find-up-cli, which performs similar upward searches for arbitrary files. It is intended for use in development environments where quick, reliable package root discovery is required.
Reviews
Loading reviews…
Similar apps
File Management & Transfer
find-up-cli
Find a file by walking up parent directories.
Terminals & CLI
npm-user-cli
Get user info of a npm user.
Terminals & CLI
npm-name-cli
Check whether a package name is available on npm.
Terminals & CLI
get-port-cli
Get an available port.
Terminals & CLI
gzip-size-cli
Get the gzipped size of a file.
Terminals & CLI
active-win-cli
Get the title/id/etc of the active window.