# pkg-up

找到最内层的package.json路径。

Find the closest package.json file

# Usage

/
└── 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'

# API

# pkgUp(options?)

Returns a Promise for the file path, or Promise if it could not be found.

# pkgUpSync(options?)

Returns the file path, or undefined if it could not be found.

# options

Type: object

# cwd

Type: string Default: process.cwd()

The directory to start from.

# 参考

pkg-up (opens new window)