aboutsummaryrefslogtreecommitdiff
path: root/node_modules/find-cache-dir
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-28 00:38:50 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-28 00:40:43 +0200
commit7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch)
tree6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/find-cache-dir
parent963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff)
downloadwallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/find-cache-dir')
-rw-r--r--node_modules/find-cache-dir/index.js33
-rw-r--r--node_modules/find-cache-dir/license21
l---------node_modules/find-cache-dir/node_modules/.bin/mkdirp1
-rw-r--r--node_modules/find-cache-dir/package.json38
-rw-r--r--node_modules/find-cache-dir/readme.md108
5 files changed, 201 insertions, 0 deletions
diff --git a/node_modules/find-cache-dir/index.js b/node_modules/find-cache-dir/index.js
new file mode 100644
index 000000000..859286285
--- /dev/null
+++ b/node_modules/find-cache-dir/index.js
@@ -0,0 +1,33 @@
+'use strict';
+var path = require('path');
+var commonDir = require('commondir');
+var pkgDir = require('pkg-dir');
+var mkdirp = require('mkdirp');
+
+module.exports = function (options) {
+ var name = options.name;
+ var dir = options.cwd;
+ if (options.files) {
+ dir = commonDir(dir, options.files);
+ } else {
+ dir = dir || process.cwd();
+ }
+
+ dir = pkgDir.sync(dir);
+
+ if (dir) {
+ dir = path.join(dir, 'node_modules', '.cache', name);
+
+ if (dir && options.create) {
+ mkdirp.sync(dir);
+ }
+
+ if (options.thunk) {
+ return function () {
+ return path.join.apply(path, [dir].concat(Array.prototype.slice.call(arguments)));
+ };
+ }
+ }
+
+ return dir;
+};
diff --git a/node_modules/find-cache-dir/license b/node_modules/find-cache-dir/license
new file mode 100644
index 000000000..ad5d021ed
--- /dev/null
+++ b/node_modules/find-cache-dir/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage)
+
+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/find-cache-dir/node_modules/.bin/mkdirp b/node_modules/find-cache-dir/node_modules/.bin/mkdirp
new file mode 120000
index 000000000..91a5f623f
--- /dev/null
+++ b/node_modules/find-cache-dir/node_modules/.bin/mkdirp
@@ -0,0 +1 @@
+../../../mkdirp/bin/cmd.js \ No newline at end of file
diff --git a/node_modules/find-cache-dir/package.json b/node_modules/find-cache-dir/package.json
new file mode 100644
index 000000000..1af1793cb
--- /dev/null
+++ b/node_modules/find-cache-dir/package.json
@@ -0,0 +1,38 @@
+{
+ "name": "find-cache-dir",
+ "version": "0.1.1",
+ "description": "My well-made module",
+ "license": "MIT",
+ "repository": "jamestalmage/find-cache-dir",
+ "author": {
+ "name": "James Talmage",
+ "email": "james@talmage.io",
+ "url": "github.com/jamestalmage"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "xo && nyc --reporter=lcov --reporter=text ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "cache",
+ "directory",
+ "dir"
+ ],
+ "dependencies": {
+ "commondir": "^1.0.1",
+ "mkdirp": "^0.5.1",
+ "pkg-dir": "^1.0.0"
+ },
+ "devDependencies": {
+ "ava": "^0.8.0",
+ "coveralls": "^2.11.6",
+ "nyc": "^5.0.1",
+ "rimraf": "^2.5.0",
+ "xo": "^0.12.1"
+ }
+}
diff --git a/node_modules/find-cache-dir/readme.md b/node_modules/find-cache-dir/readme.md
new file mode 100644
index 000000000..d0b71b19f
--- /dev/null
+++ b/node_modules/find-cache-dir/readme.md
@@ -0,0 +1,108 @@
+# find-cache-dir [![Build Status](https://travis-ci.org/jamestalmage/find-cache-dir.svg?branch=master)](https://travis-ci.org/jamestalmage/find-cache-dir) [![Coverage Status](https://coveralls.io/repos/jamestalmage/find-cache-dir/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamestalmage/find-cache-dir?branch=master)
+
+> Finds the common standard cache directory.
+
+Recently the [`nyc`](https://www.npmjs.com/package/nyc) and [`AVA`](https://www.npmjs.com/package/ava) projects decided to standardize on a common directory structure for storing cache information:
+
+```sh
+# nyc
+./node_modules/.cache/nyc
+
+# ava
+./node_modules/.cache/ava
+
+# your-module
+./node_modules/.cache/your-module
+```
+
+This module makes it easy to correctly locate the cache directory according to this shared spec. If this pattern becomes ubiquitous, clearing the cache for multiple dependencies becomes easy and consistent:
+
+```
+rm -rf ./node_modules/.cache
+```
+
+If you decide to adopt this pattern, please file a PR adding your name to the list of adopters below.
+
+
+## Install
+
+```
+$ npm install --save find-cache-dir
+```
+
+
+## Usage
+
+```js
+const findCacheDir = require('find-cache-dir');
+
+findCacheDir({name: 'unicorns'});
+//=> /user/path/node-modules/.cache/unicorns
+```
+
+
+## API
+
+### findCacheDir([options])
+
+Finds the cache dir using the supplied options. The algorithm tries to find a `package.json` file, searching every parent directory of the `cwd` specified (or implied from other options). It returns a `string` containing the absolute path to the cache directory, or `null` if `package.json` was never found.
+
+#### options
+
+##### name
+
+*Required*
+Type: `string`
+
+This should be the same as your project name in `package.json`.
+
+##### files
+
+Type: `array` of `string`
+
+An array of files that will be searched for a common parent directory. This common parent directory will be used in lieu of the `cwd` option below.
+
+##### cwd
+
+Type: `string`
+Default `process.cwd()`
+
+The directory to start searching for a `package.json` from.
+
+##### create
+
+Type: `boolean`
+Default `false`
+
+If `true`, the directory will be created synchronously before returning.
+
+##### thunk
+
+Type: `boolean`
+Default `false`
+
+If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
+
+```js
+const thunk = findCacheDir({name: 'foo', thunk: true});
+
+thunk();
+//=> /some/path/node_modules/.cache/foo
+
+thunk('bar.js')
+//=> /some/path/node_modules/.cache/foo/bar.js
+
+thunk('baz', 'quz.js')
+//=> /some/path/node_modules/.cache/foo/baz/quz.js
+```
+
+This is helpful for actually putting actual files in the cache!
+
+## Adopters
+
+- [`NYC`](https://www.npmjs.com/package/nyc)
+- [`AVA`](https://www.npmjs.com/package/ava)
+
+## License
+
+MIT © [James Talmage](http://github.com/jamestalmage)