diff options
Diffstat (limited to 'node_modules/pkg-dir')
-rw-r--r-- | node_modules/pkg-dir/index.js | 10 | ||||
-rw-r--r-- | node_modules/pkg-dir/license | 21 | ||||
-rw-r--r-- | node_modules/pkg-dir/package.json | 85 | ||||
-rw-r--r-- | node_modules/pkg-dir/readme.md | 64 |
4 files changed, 180 insertions, 0 deletions
diff --git a/node_modules/pkg-dir/index.js b/node_modules/pkg-dir/index.js new file mode 100644 index 0000000..f2fa201 --- /dev/null +++ b/node_modules/pkg-dir/index.js @@ -0,0 +1,10 @@ +'use strict'; +const path = require('path'); +const findUp = require('find-up'); + +module.exports = cwd => findUp('package.json', {cwd}).then(fp => fp ? path.dirname(fp) : null); + +module.exports.sync = cwd => { + const fp = findUp.sync('package.json', {cwd}); + return fp ? path.dirname(fp) : null; +}; diff --git a/node_modules/pkg-dir/license b/node_modules/pkg-dir/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/pkg-dir/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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..b1701dc --- /dev/null +++ b/node_modules/pkg-dir/package.json @@ -0,0 +1,85 @@ +{ + "_from": "pkg-dir@^2.0.0", + "_id": "pkg-dir@2.0.0", + "_inBundle": false, + "_integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "_location": "/pkg-dir", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "pkg-dir@^2.0.0", + "name": "pkg-dir", + "escapedName": "pkg-dir", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/find-cache-dir" + ], + "_resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "_shasum": "f6d5d1109e19d63edf428e0bd57e12777615334b", + "_spec": "pkg-dir@^2.0.0", + "_where": "/home/pruss/Dev/3-minute-website/node_modules/find-cache-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/pkg-dir/issues" + }, + "bundleDependencies": false, + "dependencies": { + "find-up": "^2.1.0" + }, + "deprecated": false, + "description": "Find the root directory of a Node.js project or npm package", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/pkg-dir#readme", + "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" + ], + "license": "MIT", + "name": "pkg-dir", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/pkg-dir.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.0" +} diff --git a/node_modules/pkg-dir/readme.md b/node_modules/pkg-dir/readme.md new file mode 100644 index 0000000..3cab12e --- /dev/null +++ b/node_modules/pkg-dir/readme.md @@ -0,0 +1,64 @@ +# 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) |