GitShow/sindresorhus/package-directory
sindresorhus

package-directory

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

by sindresorhus
Star on GitHubForknpm

JavaScript

253 stars21 forks9 contributorsQuiet · 6mo agoSince 2015v8.2.0MIT

Meet the team

See all 9 on GitHub →
sindresorhus
sindresorhus32 contributions
coreyfarrell
coreyfarrell2 contributions
BendingBender
BendingBender2 contributions
jimmywarting
jimmywarting1 contribution
kellyselden
kellyselden1 contribution
LinusU
LinusU1 contribution
Richienb
Richienb1 contribution
SamVerschueren
SamVerschueren1 contribution

Languages

View on GitHub →
JavaScript89.9%
TypeScript10.1%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
overlookmotel
Check `package.json` is root of package and not `{type: 'module'}`ClosedIssue

With ESM modules, Node has introduced a 2nd use for . So now the presence of a file does not necessarily indicate the root of a package. It could just contain to indicate that a subdirectory's files are to be treated as ESM modules. Could check the contents of files found, and ignore any which don't indicate package root? Perhaps checking for a field would do the trick.

overlookmotel · 6mo ago
rauschma
Common way of using `pkg-dir`ClosedIssue

One common way of using this package is as follows. Maybe mention that in the readme? URLs in strings seem to work, I didn’t have to use . If I’m not mistaken, using the default value for can produce incorrect results for modules.

rauschma · 6mo ago
6XGate
packageDirectory documentation says it could return undefined, but not typed to do soClosedIssue

This causes issues when using ESLint TypeScript rule as well as fails to inform TypeScript the return value is possible .

6XGate · 4y ago
Structured data for AI agents

Repository: sindresorhus/package-directory. Description: Find the root directory of a Node.js project or npm package Stars: 253, Forks: 21. Primary language: JavaScript. Languages: JavaScript (89.9%), TypeScript (10.1%). License: MIT. Latest release: v8.2.0 (6mo ago). Open PRs: 0, open issues: 0. Last activity: 6mo ago. Community health: 85%. Top contributors: sindresorhus, coreyfarrell, BendingBender, jimmywarting, kellyselden, LinusU, Richienb, SamVerschueren.

·@ofershap

Replace github.com with gitshow.dev