$ gnpm install pkg-up
Find the closest package.json file
npm install pkg-up
/
└── Users
└── sindresorhus
└── foo
├── package.json
└── bar
├── baz
└── example.js
// example.js
import {pkgUp} from 'pkg-up';
console.log(await pkgUp());
//=> '/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.
Copyright 2013 - present © cnpmjs.org | Home |