diff options
author | Joel Kronqvist <work.joelkronqvist@pm.me> | 2022-03-11 20:46:06 +0200 |
---|---|---|
committer | Joel Kronqvist <work.joelkronqvist@pm.me> | 2022-03-11 20:46:06 +0200 |
commit | 080c5819d87b933816d724a83f3bf4f1686770a7 (patch) | |
tree | 4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/pkg-dir | |
parent | 5ac7049a9d30733165cc212dee308163c2a14644 (diff) | |
parent | d003b82235a9329f912522a2f70aa950dfce4998 (diff) | |
download | LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip |
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/pkg-dir')
-rw-r--r-- | node_modules/pkg-dir/index.d.ts | 44 | ||||
-rw-r--r-- | node_modules/pkg-dir/index.js | 17 | ||||
-rw-r--r-- | node_modules/pkg-dir/license | 9 | ||||
-rw-r--r-- | node_modules/pkg-dir/package.json | 56 | ||||
-rw-r--r-- | node_modules/pkg-dir/readme.md | 66 |
5 files changed, 192 insertions, 0 deletions
diff --git a/node_modules/pkg-dir/index.d.ts b/node_modules/pkg-dir/index.d.ts new file mode 100644 index 0000000..e339404 --- /dev/null +++ b/node_modules/pkg-dir/index.d.ts @@ -0,0 +1,44 @@ +declare const pkgDir: { + /** + Find the root directory of a Node.js project or npm package. + + @param cwd - Directory to start from. Default: `process.cwd()`. + @returns The project root path or `undefined` if it couldn't be found. + + @example + ``` + // / + // └── Users + // └── sindresorhus + // └── foo + // ├── package.json + // └── bar + // ├── baz + // └── example.js + + // example.js + import pkgDir = require('pkg-dir'); + + (async () => { + const rootDir = await pkgDir(__dirname); + + console.log(rootDir); + //=> '/Users/sindresorhus/foo' + })(); + ``` + */ + (cwd?: string): Promise<string | undefined>; + + /** + Synchronously find the root directory of a Node.js project or npm package. + + @param cwd - Directory to start from. Default: `process.cwd()`. + @returns The project root path or `undefined` if it couldn't be found. + */ + sync(cwd?: string): string | undefined; + + // TODO: Remove this for the next major release + default: typeof pkgDir; +}; + +export = pkgDir; diff --git a/node_modules/pkg-dir/index.js b/node_modules/pkg-dir/index.js new file mode 100644 index 0000000..83e683d --- /dev/null +++ b/node_modules/pkg-dir/index.js @@ -0,0 +1,17 @@ +'use strict'; +const path = require('path'); +const findUp = require('find-up'); + +const pkgDir = async cwd => { + const filePath = await findUp('package.json', {cwd}); + return filePath && path.dirname(filePath); +}; + +module.exports = pkgDir; +// TODO: Remove this for the next major release +module.exports.default = pkgDir; + +module.exports.sync = cwd => { + const filePath = findUp.sync('package.json', {cwd}); + return filePath && path.dirname(filePath); +}; diff --git a/node_modules/pkg-dir/license b/node_modules/pkg-dir/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/pkg-dir/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/pkg-dir/package.json b/node_modules/pkg-dir/package.json new file mode 100644 index 0000000..aad11e8 --- /dev/null +++ b/node_modules/pkg-dir/package.json @@ -0,0 +1,56 @@ +{ + "name": "pkg-dir", + "version": "4.2.0", + "description": "Find the root directory of a Node.js project or npm package", + "license": "MIT", + "repository": "sindresorhus/pkg-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "package", + "json", + "root", + "npm", + "entry", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^4.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tempy": "^0.3.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/pkg-dir/readme.md b/node_modules/pkg-dir/readme.md new file mode 100644 index 0000000..92a77f4 --- /dev/null +++ b/node_modules/pkg-dir/readme.md @@ -0,0 +1,66 @@ +# pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir) + +> Find the root directory of a Node.js project or npm package + + +## Install + +``` +$ npm install pkg-dir +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + └── foo + ├── package.json + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +const pkgDir = require('pkg-dir'); + +(async () => { + const rootDir = await pkgDir(__dirname); + + console.log(rootDir); + //=> '/Users/sindresorhus/foo' +})(); +``` + + +## API + +### pkgDir([cwd]) + +Returns a `Promise` for either the project root path or `undefined` if it couldn't be found. + +### pkgDir.sync([cwd]) + +Returns the project root path or `undefined` if it couldn't be found. + +#### 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) |