|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | declare const pkgDir: {
|
|---|
| 2 | /**
|
|---|
| 3 | Find the root directory of a Node.js project or npm package.
|
|---|
| 4 |
|
|---|
| 5 | @param cwd - Directory to start from. Default: `process.cwd()`.
|
|---|
| 6 | @returns The project root path or `undefined` if it couldn't be found.
|
|---|
| 7 |
|
|---|
| 8 | @example
|
|---|
| 9 | ```
|
|---|
| 10 | // /
|
|---|
| 11 | // └── Users
|
|---|
| 12 | // └── sindresorhus
|
|---|
| 13 | // └── foo
|
|---|
| 14 | // ├── package.json
|
|---|
| 15 | // └── bar
|
|---|
| 16 | // ├── baz
|
|---|
| 17 | // └── example.js
|
|---|
| 18 |
|
|---|
| 19 | // example.js
|
|---|
| 20 | import pkgDir = require('pkg-dir');
|
|---|
| 21 |
|
|---|
| 22 | (async () => {
|
|---|
| 23 | const rootDir = await pkgDir(__dirname);
|
|---|
| 24 |
|
|---|
| 25 | console.log(rootDir);
|
|---|
| 26 | //=> '/Users/sindresorhus/foo'
|
|---|
| 27 | })();
|
|---|
| 28 | ```
|
|---|
| 29 | */
|
|---|
| 30 | (cwd?: string): Promise<string | undefined>;
|
|---|
| 31 |
|
|---|
| 32 | /**
|
|---|
| 33 | Synchronously find the root directory of a Node.js project or npm package.
|
|---|
| 34 |
|
|---|
| 35 | @param cwd - Directory to start from. Default: `process.cwd()`.
|
|---|
| 36 | @returns The project root path or `undefined` if it couldn't be found.
|
|---|
| 37 | */
|
|---|
| 38 | sync(cwd?: string): string | undefined;
|
|---|
| 39 |
|
|---|
| 40 | // TODO: Remove this for the next major release
|
|---|
| 41 | default: typeof pkgDir;
|
|---|
| 42 | };
|
|---|
| 43 |
|
|---|
| 44 | export = pkgDir;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.