mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 05:35:05 +08:00
Will be used to make sure no default exports are in DevTools. The PRESUBMIT.py has been updated to skip running the formatting check if node_modules files are affected, to workaround crbug.com/1068198. DISABLE_THIRD_PARTY_CHECK=Add plugin to node_modules Bug: 1068198 Change-Id: I04d4dc813daa01099f21d40edf47aaefcc0b045f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2135610 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
65 lines
1.2 KiB
Markdown
65 lines
1.2 KiB
Markdown
# pkg-dir [](https://travis-ci.org/sindresorhus/pkg-dir)
|
|
|
|
> Find the root directory of a Node.js project or npm package
|
|
|
|
|
|
## Install
|
|
|
|
```
|
|
$ npm install --save pkg-dir
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```
|
|
/
|
|
└── Users
|
|
└── sindresorhus
|
|
└── foo
|
|
├── package.json
|
|
└── bar
|
|
├── baz
|
|
└── example.js
|
|
```
|
|
|
|
```js
|
|
// example.js
|
|
const pkgDir = require('pkg-dir');
|
|
|
|
pkgDir(__dirname).then(rootDir => {
|
|
console.log(rootDir);
|
|
//=> '/Users/sindresorhus/foo'
|
|
});
|
|
```
|
|
|
|
|
|
## API
|
|
|
|
### pkgDir([cwd])
|
|
|
|
Returns a `Promise` for either the project root path or `null` if it couldn't be found.
|
|
|
|
### pkgDir.sync([cwd])
|
|
|
|
Returns the project root path or `null`.
|
|
|
|
#### cwd
|
|
|
|
Type: `string`<br>
|
|
Default: `process.cwd()`
|
|
|
|
Directory to start from.
|
|
|
|
|
|
## Related
|
|
|
|
- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module
|
|
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
|
|
- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories
|
|
|
|
|
|
## License
|
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|