Skip to content

Commit e917c7b

Browse files
committed
Require Node.js 18
1 parent 5536c24 commit e917c7b

File tree

4 files changed

+54
-49
lines changed

4 files changed

+54
-49
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 16
13+
- 20
14+
- 18
1415
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v2
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
1718
with:
1819
node-version: ${{ matrix.node-version }}
1920
- run: npm install

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import process from 'node:process';
22
import path from 'node:path';
33
import fs from 'node:fs';
44
import minimist from 'minimist';
5-
import {readPackageUpSync} from 'read-pkg-up';
6-
import {writePackageSync} from 'write-pkg';
7-
import execa from 'execa';
5+
import {readPackageUpSync} from 'read-package-up';
6+
import {writePackageSync} from 'write-package';
7+
import {execa} from 'execa';
88
import hasYarn from 'has-yarn';
99

1010
const DEFAULT_TEST_SCRIPT = 'echo "Error: no test specified" && exit 1';

package.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"bin": "./cli.js",
1515
"exports": "./index.js",
1616
"engines": {
17-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
17+
"node": ">=18"
1818
},
1919
"scripts": {
2020
"test": "xo && ava"
@@ -35,16 +35,19 @@
3535
"xo"
3636
],
3737
"dependencies": {
38-
"execa": "^5.1.1",
38+
"execa": "^8.0.1",
3939
"has-yarn": "^3.0.0",
40-
"minimist": "^1.2.5",
41-
"read-pkg-up": "^9.0.0",
42-
"write-pkg": "^5.0.0"
40+
"minimist": "^1.2.8",
41+
"read-package-up": "^11.0.0",
42+
"write-package": "^7.0.0"
4343
},
4444
"devDependencies": {
45-
"ava": "^3.15.0",
46-
"dot-prop": "^6.0.1",
45+
"ava": "^5.3.1",
46+
"dot-prop": "^8.0.2",
4747
"temp-write": "^5.0.0",
48-
"xo": "^0.45.0"
48+
"xo": "^0.56.0"
49+
},
50+
"ava": {
51+
"timeout": "10m"
4952
}
5053
}

test.js

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import path from 'node:path';
22
import fs from 'node:fs';
33
import process from 'node:process';
44
import tempWrite from 'temp-write';
5-
import dotProp from 'dot-prop';
5+
import {getProperty} from 'dot-prop';
66
import test from 'ava';
77
import createXo from './index.js';
88

99
const originalArgv = [...process.argv];
10-
const {get} = dotProp;
1110

1211
async function run(pkg) {
1312
const filepath = tempWrite.sync(JSON.stringify(pkg), 'package.json');
@@ -22,8 +21,8 @@ async function run(pkg) {
2221

2322
test('empty package.json', async t => {
2423
const pkg = await run({});
25-
t.is(get(pkg, 'scripts.test'), 'xo');
26-
t.is(get(pkg, 'xo'), undefined);
24+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
25+
t.is(getProperty(pkg, 'xo'), undefined);
2726
});
2827

2928
test('has scripts', async t => {
@@ -33,8 +32,8 @@ test('has scripts', async t => {
3332
},
3433
});
3534

36-
t.is(get(pkg, 'scripts.test'), 'xo');
37-
t.is(get(pkg, 'xo'), undefined);
35+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
36+
t.is(getProperty(pkg, 'xo'), undefined);
3837
});
3938

4039
test('has default test', async t => {
@@ -44,8 +43,8 @@ test('has default test', async t => {
4443
},
4544
});
4645

47-
t.is(get(pkg, 'scripts.test'), 'xo');
48-
t.is(get(pkg, 'xo'), undefined);
46+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
47+
t.is(getProperty(pkg, 'xo'), undefined);
4948
});
5049

5150
test('has only xo', async t => {
@@ -55,8 +54,8 @@ test('has only xo', async t => {
5554
},
5655
});
5756

58-
t.is(get(pkg, 'scripts.test'), 'xo');
59-
t.is(get(pkg, 'xo'), undefined);
57+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
58+
t.is(getProperty(pkg, 'xo'), undefined);
6059
});
6160

6261
test('has test', async t => {
@@ -66,8 +65,8 @@ test('has test', async t => {
6665
},
6766
});
6867

69-
t.is(get(pkg, 'scripts.test'), 'xo && ava');
70-
t.is(get(pkg, 'xo'), undefined);
68+
t.is(getProperty(pkg, 'scripts.test'), 'xo && ava');
69+
t.is(getProperty(pkg, 'xo'), undefined);
7170
});
7271

7372
test('has cli args', async t => {
@@ -80,8 +79,8 @@ test('has cli args', async t => {
8079
});
8180

8281
process.argv = originalArgv;
83-
t.is(get(pkg, 'scripts.test'), 'xo');
84-
t.is(get(pkg, 'xo.space'), true);
82+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
83+
t.is(getProperty(pkg, 'xo.space'), true);
8584
});
8685

8786
test('has cli args and test', async t => {
@@ -94,9 +93,9 @@ test('has cli args and test', async t => {
9493
});
9594

9695
process.argv = originalArgv;
97-
t.is(get(pkg, 'scripts.test'), 'xo && ava');
98-
t.is(get(pkg, 'xo.envs.0'), 'node');
99-
t.is(get(pkg, 'xo.envs.1'), 'browser');
96+
t.is(getProperty(pkg, 'scripts.test'), 'xo && ava');
97+
t.is(getProperty(pkg, 'xo.envs[0]'), 'node');
98+
t.is(getProperty(pkg, 'xo.envs[1]'), 'browser');
10099
});
101100

102101
test('has cli args and existing config', async t => {
@@ -109,9 +108,9 @@ test('has cli args and existing config', async t => {
109108
});
110109

111110
process.argv = originalArgv;
112-
t.is(get(pkg, 'scripts.test'), 'xo');
113-
t.is(get(pkg, 'xo.space'), true);
114-
t.is(get(pkg, 'xo.esnext'), true);
111+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
112+
t.is(getProperty(pkg, 'xo.space'), true);
113+
t.is(getProperty(pkg, 'xo.esnext'), true);
115114
});
116115

117116
test('has existing config without cli args', async t => {
@@ -124,12 +123,13 @@ test('has existing config without cli args', async t => {
124123
});
125124

126125
process.argv = originalArgv;
127-
t.is(get(pkg, 'scripts.test'), 'xo');
128-
t.deepEqual(get(pkg, 'xo'), {esnext: true});
126+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
127+
t.deepEqual(getProperty(pkg, 'xo'), {esnext: true});
129128
});
130129

131130
test('has everything covered when it comes to config', async t => {
132-
process.argv = [...originalArgv,
131+
process.argv = [
132+
...originalArgv,
133133
'--space',
134134
'--esnext',
135135
'--no-semicolon',
@@ -138,27 +138,28 @@ test('has everything covered when it comes to config', async t => {
138138
'--global=foo',
139139
'--global=bar',
140140
'--ignore=foo',
141-
'--ignore=bar'];
141+
'--ignore=bar',
142+
];
142143

143144
const pkg = await run({});
144145

145146
process.argv = originalArgv;
146-
t.is(get(pkg, 'scripts.test'), 'xo');
147-
t.is(get(pkg, 'xo.space'), true);
148-
t.is(get(pkg, 'xo.esnext'), true);
149-
t.is(get(pkg, 'xo.semicolon'), false);
150-
t.is(get(pkg, 'xo.envs.0'), 'foo');
151-
t.is(get(pkg, 'xo.envs.1'), 'bar');
152-
t.is(get(pkg, 'xo.globals.0'), 'foo');
153-
t.is(get(pkg, 'xo.globals.1'), 'bar');
154-
t.is(get(pkg, 'xo.ignores.0'), 'foo');
155-
t.is(get(pkg, 'xo.ignores.1'), 'bar');
147+
t.is(getProperty(pkg, 'scripts.test'), 'xo');
148+
t.is(getProperty(pkg, 'xo.space'), true);
149+
t.is(getProperty(pkg, 'xo.esnext'), true);
150+
t.is(getProperty(pkg, 'xo.semicolon'), false);
151+
t.is(getProperty(pkg, 'xo.envs[0]'), 'foo');
152+
t.is(getProperty(pkg, 'xo.envs[1]'), 'bar');
153+
t.is(getProperty(pkg, 'xo.globals[0]'), 'foo');
154+
t.is(getProperty(pkg, 'xo.globals[1]'), 'bar');
155+
t.is(getProperty(pkg, 'xo.ignores[0]'), 'foo');
156+
t.is(getProperty(pkg, 'xo.ignores[1]'), 'bar');
156157
});
157158

158159
test('installs the XO dependency', async t => {
159160
const filepath = tempWrite.sync(JSON.stringify({}), 'package.json');
160161
await createXo({cwd: path.dirname(filepath)});
161-
t.truthy(get(JSON.parse(fs.readFileSync(filepath, 'utf8')), 'devDependencies.xo'));
162+
t.truthy(getProperty(JSON.parse(fs.readFileSync(filepath, 'utf8')), 'devDependencies.xo'));
162163
});
163164

164165
test('installs via yarn if there\'s a lockfile', async t => {

0 commit comments

Comments
 (0)