Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Find the closest package.json file

License

NotificationsYou must be signed in to change notification settings

sindresorhus/package-up

Repository files navigation

Find the closest package.json file

Install

npm install package-up

Usage

/└── Users    └── sindresorhus        └── foo            ├── package.json            └── bar                ├── baz                └── example.js
// example.jsimport{packageUp}from'package-up';console.log(awaitpackageUp());//=> '/Users/sindresorhus/foo/package.json'

API

packageUp(options?)

Returns aPromise<string> for the file path, orPromise<undefined> if it could not be found.

packageUpSync(options?)

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

options

Type:object

cwd

Type:string
Default:process.cwd()

The directory to start from.

Related

  • 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

[8]ページ先頭

©2009-2025 Movatter.jp