{"name":"package-directory","version":"8.2.0","description":"Find the root directory of a Node.js project or npm package","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/package-directory.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["package","json","root","npm","entry","find","up","find-up","findup","look-up","look","file","search","match","resolve","parent","parents","folder","directory","walk","walking","path"],"dependencies":{"find-up-simple":"^1.0.0"},"devDependencies":{"ava":"^5.3.1","tempy":"^3.1.0","tsd":"^0.29.0","xo":"^0.56.0"},"gitHead":"516b394cc157c5c23d72ca287d9f3498dd9dd1df","types":"./index.d.ts","_id":"package-directory@8.2.0","bugs":{"url":"https://github.com/sindresorhus/package-directory/issues"},"homepage":"https://github.com/sindresorhus/package-directory#readme","_nodeVersion":"25.3.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-qJSu5Mo6tHmRxCy2KCYYKYgcfBdUpy9dwReaZD/xwf608AUk/MoRtIOWzgDtUeGeC7n/55yC3MI1Q+MbSoektw==","shasum":"b4f9df2e56782beb1d805945e2c530d29a3806f9","tarball":"http://registry-npm.ywwl.com/package-directory/download/package-directory-8.2.0.tgz","fileCount":5,"unpackedSize":7846,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFliONMXWDvDjhUU2OW3PVwOwzrnerXaX5tg9AHJ8TCHAiEAvsRqydiKNZLx5uM0UkdrUh6XJzOtiCs9jEnJC8cWRlg="}],"size":2580,"noattachment":false,"key":"/package-directory/-/package-directory-8.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/package-directory_8.2.0_1769957542335_0.6904004299656012"},"_hasShrinkwrap":false,"readme":"# package-directory\n\n> Find the root directory of a Node.js project or npm package\n\n## Install\n\n```sh\nnpm install package-directory\n```\n\n## Usage\n\n```\n/\n└── Users\n    └── sindresorhus\n        └── foo\n            ├── package.json\n            └── bar\n                ├── baz\n                └── example.js\n```\n\n```js\n// example.js\nimport {packageDirectory} from 'package-directory';\n\nconsole.log(await packageDirectory());\n//=> '/Users/sindresorhus/foo'\n```\n\n## API\n\n### packageDirectory(option?)\n\nReturns a `Promise` for either the project root path or `undefined` if it could not be found.\n\n### packageDirectorySync(options?)\n\nReturns the project root path or `undefined` if it could not be found.\n\n#### options\n\nType: `object`\n\n##### cwd\n\nType: `string`\\\nDefault: `process.cwd()`\n\nThe directory to start searching from.\n\n##### ignoreTypeOnlyPackageJson\n\nType: `boolean`\\\nDefault: `false`\n\nIgnore `package.json` files that only contain the `type` field.\n\nThis treats `{\"type\":\"module\"}` files as ESM scope markers instead of package roots.\n\n## Related\n\n- [package-directory-cli](https://github.com/sindresorhus/package-directory-cli) - CLI for this package\n- [package-up](https://github.com/sindresorhus/package-up) - Find the closest package.json file\n- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories\n","publish_time":1769957542473,"_cnpm_publish_time":1769957542473,"dist-tags":{"latest":"8.2.0"}}