Find the closest package.json file
npm install package-up
/
└── Users
└── sindresorhus
└── foo
├── package.json
└── bar
├── baz
└── example.js
// example.js
import {packageUp} from 'package-up';
console.log(await packageUp());
//=> '/Users/sindresorhus/foo/package.json'
Returns a Promise<string>
for the file path, or Promise<undefined>
if it could not be found.
Returns the file path, or undefined
if it could not be found.
Type: object
Type: string
Default: process.cwd()
The directory to start from.
- read-package-up - Read the closest package.json file
- pkg-dir - Find the root directory of an npm package
- find-up - Find a file by walking up parent directories