pkg-dir
npmv9.0.0TypeScriptDeprecatedFind the root directory of a Node.js project or npm package
Deprecation notice: Renamed to `package-directory`.
Not recommended for new projects
No — pkg-dir should not be adopted for new projects. Explicitly marked deprecated by its publisher.
- ?Adoption: grade ?, Not reported by this registry.
No download data reported for this package yet.
- FMaintenance: grade F, Failing.
Explicitly marked deprecated by its publisher.
- AWeight: grade A, Excellent.
Pulls in 1 transitive package, about 12 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding pkg-dir to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Licenses in the dependency tree
Every license you inherit by installing pkg-dir, not just its own. Check this before a legal review, not after.
Compatibility
- Node.js
- node >=18
- Module format
- ESM only
- TypeScript
- Types included
- Install scripts
- None
Quick start
A usage example from the pkg-dir README.
// example.js
import {packageDirectory} from 'pkg-dir';
console.log(await packageDirectory());
//=> '/Users/sindresorhus/foo'pkg-dir vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| pkg-dirthis page | 0 | 1 | MIT | 1 year ago |
| find-up-simple | 0 | 2 | MIT | 1 day ago |
| find-up | 0 | 4 | MIT | 1 day ago |
| escalade | 136.6M | 3 | MIT | 1 day ago |
| make-dir | 0 | 2 | MIT | 1 day ago |
| locate-path | 0 | 1 | MIT | 1 day ago |
Dependencies
Declared by pkg-dir v9.0.0. Runtime dependencies are installed with the package; dev dependencies are not.
Runtime (1)
Dev (4)
Used by
Popular packages that depend on pkg-dir.
Relationship graph
Dependencies (left) and dependents (right) of pkg-dir.
Frequently installed together
Release history
1 release in the last two years, typically about 351 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 9.0.0latest | 1 year ago | 4.8 KB | MIT |
| 8.0.0 | 2 years ago | 4.8 KB | MIT |
| 7.0.0 | 4 years ago | 5.2 KB | MIT |
| 6.0.1 | 5 years ago | 5.2 KB | MIT |
| 6.0.0 | 5 years ago | 5.2 KB | MIT |
| 5.0.0 | 5 years ago | 4.9 KB | MIT |
| 4.2.0 | 7 years ago | 4.6 KB | MIT |
| 4.1.0 | 7 years ago | 4.6 KB | MIT |
| 4.0.0 | 7 years ago | 4.1 KB | MIT |
| 3.0.0 | 8 years ago | 3.3 KB | MIT |
| 2.0.0 | 9 years ago | — | MIT |
| 1.0.0 | 11 years ago | — | MIT |
Overview
pkg-dir is a deprecated npm package that find the root directory of a Node.js project or npm package. It has 1 known dependents in the graph. The latest version is 9.0.0, released under the MIT license.
Who should use it
pkg-dir is deprecated and is best avoided for new projects. Existing users should plan a migration to a maintained alternative.
When not to use it
Do not adopt this package for new work — it is no longer maintained.
Pros
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
Cons
- Marked deprecated: Renamed to `package-directory`.
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Funding
Frequently asked questions
Should I use pkg-dir?
No — pkg-dir should not be adopted for new projects. Explicitly marked deprecated by its publisher.
How do I install pkg-dir?
Run `npm install pkg-dir` to add pkg-dir to your npm project.
How many dependencies does pkg-dir have?
pkg-dir declares 5 direct dependencies and pulls in 1 packages in total once its runtime tree is resolved totalling about 12 KB on disk.
What license is pkg-dir released under?
pkg-dir is distributed under the MIT license.
How popular is pkg-dir?
npm does not publish download counts. Within PackageGraph's crawl, 1 known packages depend on pkg-dir.
Is pkg-dir still maintained?
No — pkg-dir is marked as deprecated: Renamed to `package-directory`.. Consider a maintained alternative for new projects.
Does pkg-dir run install scripts?
No. pkg-dir does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.