{"id":31380004,"url":"https://github.com/sindresorhus/package-directory","last_synced_at":"2025-09-28T09:02:40.493Z","repository":{"id":46541304,"uuid":"41724281","full_name":"sindresorhus/package-directory","owner":"sindresorhus","description":"Find the root directory of a Node.js project or npm package","archived":false,"fork":false,"pushed_at":"2025-06-05T18:32:10.000Z","size":31,"stargazers_count":246,"open_issues_count":2,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-08-27T06:57:49.920Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-09-01T07:39:43.000Z","updated_at":"2025-08-02T16:16:35.000Z","dependencies_parsed_at":"2024-01-11T20:47:07.391Z","dependency_job_id":"50b26633-d769-4a0c-bbf7-8689ed5a4c65","html_url":"https://github.com/sindresorhus/package-directory","commit_stats":{"total_commits":36,"total_committers":9,"mean_commits":4.0,"dds":0.2777777777777778,"last_synced_commit":"fe0b0fbe45a2b3bd92961cbc586d8fde90e58e01"},"previous_names":["sindresorhus/package-directory"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/sindresorhus/package-directory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fpackage-directory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fpackage-directory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fpackage-directory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fpackage-directory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/package-directory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fpackage-directory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273581802,"owners_count":25131393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-28T09:01:17.834Z","updated_at":"2025-09-28T09:02:40.487Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Packages"],"sub_categories":["Filesystem"],"readme":"# package-directory\n\n\u003e 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//=\u003e '/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## 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fpackage-directory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fpackage-directory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fpackage-directory/lists"}