</>PackageGraphPackageGraph

pkg-dir

npmv9.0.0TypeScriptDeprecated

Find 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.

1
Direct dependencies

Runtime packages this one declares itself.

1
Total installed

Distinct packages in the full runtime tree, deduplicated the way a package manager would.

12 KB
Install size

Unpacked size of this package plus its entire runtime tree.

1
Tree depth

Longest resolved dependency chain below this package.

Licenses in the dependency tree

MIT

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.

PackageWeekly downloadsDependentsLicenseLast release
pkg-dirthis page01MIT1 year ago
find-up-simple02MIT1 day ago
find-up04MIT1 day ago
escalade136.6M3MIT1 day ago
make-dir02MIT1 day ago
locate-path01MIT1 day ago

Dependencies

Declared by pkg-dir v9.0.0. Runtime dependencies are installed with the package; dev dependencies are not.

Dev (4)

ava ^5.3.1tempy ^3.1.0tsd ^0.29.0xo ^0.56.0

Used by

Popular packages that depend on pkg-dir.

Relationship graph

Dependencies (left) and dependents (right) of pkg-dir.

find-up-simpleimport-localpkg-dir
pkg-dir dependencies dependents

Frequently installed together

Release history

1 release in the last two years, typically about 351 days apart.

Recent versions of pkg-dir
VersionPublishedSizeLicense
9.0.0latest1 year ago4.8 KBMIT
8.0.02 years ago4.8 KBMIT
7.0.04 years ago5.2 KBMIT
6.0.15 years ago5.2 KBMIT
6.0.05 years ago5.2 KBMIT
5.0.05 years ago4.9 KBMIT
4.2.07 years ago4.6 KBMIT
4.1.07 years ago4.6 KBMIT
4.0.07 years ago4.1 KBMIT
3.0.08 years ago3.3 KBMIT
2.0.09 years agoMIT
1.0.011 years agoMIT

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

Keywords

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.