VibeHunt
Back to browse
pkg-dir-cli

pkg-dir-cli

Find the root directory of a npm package.

Source

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

Sign in to leave a review.

Loading reviews…

Similar apps