sindresorhus

package-directory

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

by sindresorhus

JavaScript

JavaScript89.9%
TypeScript10.1%

Commit activity

Last 12 weeks · 1 commit

Full graph →

Community health

4 of 6 standards met

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

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 · 8mo ago
rauschma

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 · 8mo ago
Structured data for AI agents

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