Skip to content

Commit 8e826b0

Browse files
committed
Require Node.js 20
1 parent 81a1286 commit 8e826b0

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 22
1314
- 20
14-
- 18
15-
- 16
1615
steps:
1716
- uses: actions/checkout@v4
1817
- uses: actions/setup-node@v4

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"sideEffects": false,
1919
"engines": {
20-
"node": ">=16"
20+
"node": ">=20"
2121
},
2222
"scripts": {
2323
"test": "xo && ava && tsd"
@@ -35,16 +35,21 @@
3535
],
3636
"dependencies": {
3737
"common-path-prefix": "^3.0.0",
38-
"pkg-dir": "^7.0.0"
38+
"pkg-dir": "^8.0.0"
3939
},
4040
"devDependencies": {
41-
"ava": "^5.3.1",
42-
"del": "^7.0.0",
41+
"ava": "^6.2.0",
42+
"del": "^8.0.0",
4343
"tempy": "^3.1.0",
44-
"tsd": "^0.28.1",
45-
"xo": "^0.56.0"
44+
"tsd": "^0.31.2",
45+
"xo": "^0.60.0"
4646
},
4747
"ava": {
4848
"workerThreads": false
49+
},
50+
"xo": {
51+
"rules": {
52+
"n/no-unsupported-features/node-builtins": "off"
53+
}
4954
}
5055
}

test.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
import process from 'node:process';
22
import fs from 'node:fs';
33
import path from 'node:path';
4-
import {fileURLToPath} from 'node:url';
54
import test from 'ava';
65
import {deleteSync} from 'del';
76
import {temporaryDirectory} from 'tempy';
87
import findCacheDirectory from './index.js';
98

10-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
9+
const {dirname} = import.meta;
1110

1211
test('finds from a list of files', t => {
13-
process.chdir(path.join(__dirname, '..'));
14-
const files = ['foo/bar', 'baz/quz'].map(file => path.join(__dirname, file));
15-
t.is(findCacheDirectory({files, name: 'blah'}), path.join(__dirname, 'node_modules', '.cache', 'blah'));
12+
process.chdir(path.join(dirname, '..'));
13+
const files = ['foo/bar', 'baz/quz'].map(file => path.join(dirname, file));
14+
t.is(findCacheDirectory({files, name: 'blah'}), path.join(dirname, 'node_modules', '.cache', 'blah'));
1615
});
1716

1817
test('finds from process.cwd', t => {
19-
process.chdir(path.join(__dirname));
20-
t.is(findCacheDirectory({name: 'foo'}), path.join(__dirname, 'node_modules', '.cache', 'foo'));
18+
process.chdir(path.join(dirname));
19+
t.is(findCacheDirectory({name: 'foo'}), path.join(dirname, 'node_modules', '.cache', 'foo'));
2120
});
2221

2322
test('finds from options.cwd', t => {
24-
process.chdir(path.join(__dirname, '..'));
25-
t.is(findCacheDirectory({cwd: __dirname, name: 'bar'}), path.join(__dirname, 'node_modules', '.cache', 'bar'));
23+
process.chdir(path.join(dirname, '..'));
24+
t.is(findCacheDirectory({cwd: dirname, name: 'bar'}), path.join(dirname, 'node_modules', '.cache', 'bar'));
2625
});
2726

2827
test('creates directory', t => {
29-
const directory = path.join(__dirname, 'node_modules', '.cache', 'created');
28+
const directory = path.join(dirname, 'node_modules', '.cache', 'created');
3029
deleteSync(directory);
31-
findCacheDirectory({create: true, name: 'created', cwd: __dirname});
30+
findCacheDirectory({create: true, name: 'created', cwd: dirname});
3231
t.true(fs.existsSync(directory));
3332
});
3433

3534
test('returns undefined if it can\'t find package.json', t => {
36-
process.chdir(path.join(__dirname, '..'));
35+
process.chdir(path.join(dirname, '..'));
3736
t.is(findCacheDirectory({name: 'foo'}), undefined);
3837
});
3938

@@ -53,5 +52,5 @@ test('supports CACHE_DIR environment variable', t => {
5352
test('ignores `false` for CACHE_DIR environment variable', t => {
5453
process.env.CACHE_DIR = 'false';
5554

56-
t.not(findCacheDirectory(), path.resolve(__dirname, 'false', 'find-cache-directory'));
55+
t.not(findCacheDirectory(), path.resolve(dirname, 'false', 'find-cache-directory'));
5756
});

0 commit comments

Comments
 (0)