Skip to content

Commit a0c487f

Browse files
committedDec 12, 2019
Meta tweaks
1 parent a2679d9 commit a0c487f

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed
 

‎.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: node_js
22
node_js:
3+
- '12'
34
- '10'
45
- '8'
56
after_script:

‎index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ module.exports = (options = {}) => {
2828

2929
if (directory) {
3030
const nodeModules = path.join(directory, 'node_modules');
31-
if (!isWritable(nodeModules)) {
32-
if (fs.existsSync(nodeModules) || !isWritable(path.join(directory))) {
33-
return undefined;
34-
}
31+
if (
32+
!isWritable(nodeModules) &&
33+
(fs.existsSync(nodeModules) || !isWritable(path.join(directory)))
34+
) {
35+
return undefined;
3536
}
3637

3738
directory = path.join(directory, 'node_modules', '.cache', name);

‎package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Finds the common standard cache directory",
55
"license": "MIT",
66
"repository": "avajs/find-cache-dir",
7+
"funding": "https://github.com/avajs/find-cache-dir?sponsor=1",
78
"engines": {
89
"node": ">=8"
910
},
@@ -27,11 +28,11 @@
2728
"pkg-dir": "^4.1.0"
2829
},
2930
"devDependencies": {
30-
"ava": "^1.3.1",
31-
"coveralls": "^3.0.3",
31+
"ava": "^2.4.0",
32+
"coveralls": "^3.0.9",
3233
"del": "^4.0.0",
33-
"nyc": "^13.3.0",
34-
"xo": "^0.24.0"
34+
"nyc": "^14.1.1",
35+
"xo": "^0.25.3"
3536
},
3637
"nyc": {
3738
"reporter": [

‎readme.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ rm -rf ./node_modules/.cache
2323

2424
If you decide to adopt this pattern, please file a PR adding your name to the list of adopters below.
2525

26-
2726
## Install
2827

2928
```
3029
$ npm install find-cache-dir
3130
```
3231

33-
3432
## Usage
3533

3634
```js
@@ -40,7 +38,6 @@ findCacheDir({name: 'unicorns'});
4038
//=> '/user/path/node-modules/.cache/unicorns'
4139
```
4240

43-
4441
## API
4542

4643
### findCacheDir(options?)
@@ -53,7 +50,7 @@ Type: `object`
5350

5451
##### name
5552

56-
*Required*<br>
53+
*Required*\
5754
Type: `string`
5855

5956
Should be the same as your project name in `package.json`.
@@ -66,21 +63,21 @@ An array of files that will be searched for a common parent directory. This comm
6663

6764
##### cwd
6865

69-
Type: `string`<br>
66+
Type: `string`\
7067
Default `process.cwd()`
7168

7269
Directory to start searching for a `package.json` from.
7370

7471
##### create
7572

76-
Type: `boolean`<br>
73+
Type: `boolean`\
7774
Default `false`
7875

7976
If `true`, the directory will be created synchronously before returning.
8077

8178
##### thunk
8279

83-
Type: `boolean`<br>
80+
Type: `boolean`\
8481
Default `false`
8582

8683
If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
@@ -100,7 +97,6 @@ thunk('baz', 'quz.js')
10097

10198
This is helpful for actually putting actual files in the cache!
10299

103-
104100
## Adopters
105101

106102
- [`AVA`](https://ava.li)
@@ -111,7 +107,6 @@ This is helpful for actually putting actual files in the cache!
111107
- [`Phenomic`](https://phenomic.io)
112108
- [`javascripthon-loader`](https://github.com/Beg-in/javascripthon-loader)
113109

114-
115110
---
116111

117112
<div align="center">

0 commit comments

Comments
 (0)
Please sign in to comment.