Skip to content

Commit 65992b4

Browse files
Require Node.js 16 (#569)
Co-authored-by: Sindre Sorhus <[email protected]>
1 parent db58085 commit 65992b4

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 20
1314
- 18
1415
- 16
15-
- 14
1616
os:
1717
- ubuntu-latest
1818
- macos-latest
@@ -25,6 +25,6 @@ jobs:
2525
- run: npm install
2626
- run: npm test
2727
- uses: codecov/codecov-action@v2
28-
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 18
28+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
2929
with:
3030
fail_ci_if_error: true

index.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ export type CommonOptions<EncodingType> = {
208208
209209
When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `false`.
210210
211-
*Requires Node.js 16 or later.*
212-
213211
@example
214212
```
215213
import {execa} from 'execa';

lib/command.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ const normalizeArgs = (file, args = []) => {
1010
};
1111

1212
const NO_ESCAPE_REGEXP = /^[\w.-]+$/;
13-
const DOUBLE_QUOTES_REGEXP = /"/g;
1413

1514
const escapeArg = arg => {
1615
if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) {
1716
return arg;
1817
}
1918

20-
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
19+
return `"${arg.replaceAll('"', '\\"')}"`;
2120
};
2221

2322
export const joinCommand = (file, args) => normalizeArgs(file, args).join(' ');
@@ -31,7 +30,7 @@ export const parseCommand = command => {
3130
const tokens = [];
3231
for (const token of command.trim().split(SPACES_REGEXP)) {
3332
// Allow spaces to be escaped by a backslash if not meant as a delimiter
34-
const previousToken = tokens[tokens.length - 1];
33+
const previousToken = tokens.at(-1);
3534
if (previousToken && previousToken.endsWith('\\')) {
3635
// Merge previous token with current one
3736
tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
@@ -80,7 +79,7 @@ const concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0
8079
? [...tokens, ...nextTokens]
8180
: [
8281
...tokens.slice(0, -1),
83-
`${tokens[tokens.length - 1]}${nextTokens[0]}`,
82+
`${tokens.at(-1)}${nextTokens[0]}`,
8483
...nextTokens.slice(1),
8584
];
8685

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"url": "https://sindresorhus.com"
1212
},
1313
"type": "module",
14-
"exports": "./index.js",
14+
"exports": {
15+
"types": "./index.d.ts",
16+
"default": "./index.js"
17+
},
1518
"engines": {
16-
"node": "^14.18.0 || ^16.14.0 || >=18.0.0"
19+
"node": ">=16.17"
1720
},
1821
"scripts": {
1922
"test": "xo && c8 ava && tsd"
@@ -44,7 +47,7 @@
4447
"dependencies": {
4548
"cross-spawn": "^7.0.3",
4649
"get-stream": "^6.0.1",
47-
"human-signals": "^4.3.0",
50+
"human-signals": "^5.0.0",
4851
"is-stream": "^3.0.0",
4952
"merge-stream": "^2.0.0",
5053
"npm-run-path": "^5.1.0",
@@ -53,16 +56,16 @@
5356
"strip-final-newline": "^3.0.0"
5457
},
5558
"devDependencies": {
56-
"@types/node": "^18.13.0",
59+
"@types/node": "^20.4.0",
5760
"ava": "^5.2.0",
58-
"c8": "^7.12.0",
59-
"get-node": "^13.5.0",
61+
"c8": "^8.0.1",
62+
"get-node": "^14.2.0",
6063
"is-running": "^2.1.0",
61-
"p-event": "^5.0.1",
64+
"p-event": "^6.0.0",
6265
"path-key": "^4.0.0",
63-
"tempfile": "^4.0.0",
64-
"tsd": "^0.25.0",
65-
"xo": "^0.54.2"
66+
"tempfile": "^5.0.0",
67+
"tsd": "^0.28.1",
68+
"xo": "^0.55.0"
6669
},
6770
"c8": {
6871
"reporter": [

readme.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,6 @@ You can abort the spawned process using [`AbortController`](https://developer.mo
713713

714714
When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `false`.
715715

716-
*Requires Node.js 16 or later.*
717-
718716
#### windowsVerbatimArguments
719717

720718
Type: `boolean`\

test/pipe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test('pipeAll() can pipe stdout to streams', pipeToStream, 'noop.js', 'pipeAll',
3232
test('pipeAll() can pipe stderr to streams', pipeToStream, 'noop-err.js', 'pipeAll', 'stderr');
3333

3434
const pipeToFile = async (t, fixtureName, funcName, streamName) => {
35-
const file = tempfile('.txt');
35+
const file = tempfile({extension: '.txt'});
3636
const result = await execa(fixtureName, ['test'], {all: true})[funcName](file);
3737
t.is(result[streamName], 'test');
3838
t.is(await readFile(file, 'utf8'), 'test\n');

test/stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ test('buffer', async t => {
1818
});
1919

2020
test('pass `stdout` to a file descriptor', async t => {
21-
const file = tempfile('.txt');
21+
const file = tempfile({extension: '.txt'});
2222
await execa('noop.js', ['foo bar'], {stdout: fs.openSync(file, 'w')});
2323
t.is(fs.readFileSync(file, 'utf8'), 'foo bar\n');
2424
});
2525

2626
test('pass `stderr` to a file descriptor', async t => {
27-
const file = tempfile('.txt');
27+
const file = tempfile({extension: '.txt'});
2828
await execa('noop-err.js', ['foo bar'], {stderr: fs.openSync(file, 'w')});
2929
t.is(fs.readFileSync(file, 'utf8'), 'foo bar\n');
3030
});

test/verbose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {setFixtureDir} from './helpers/fixtures-dir.js';
44

55
setFixtureDir();
66

7-
const normalizeTimestamp = output => output.replace(/\d/g, '0');
7+
const normalizeTimestamp = output => output.replaceAll(/\d/g, '0');
88
const testTimestamp = '[00:00:00.000]';
99

1010
test('Prints command when "verbose" is true', async t => {

0 commit comments

Comments
 (0)