Require Node.js 16 (#569)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent db58085 · Browse files · 8 files·+22 added−24 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Diff stats
8 files+22 added−24 removed
- tests:+4 added−4 removed
- other:+18 added−20 removed
Provenance
- Commit
65992b4- Tree
ae2fb65- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
db58085
8 files changed+22 added−24 removed
modified:.github/workflows/main.yml+2 added-2 removed
8 unmodified lines910111213141515161718194 unmodified lines24252627282829308 unmodified lines strategy: fail-fast: false matrix: node-version: - 20 - 18 - 16 - 14 os: - ubuntu-latest - macos-latest - windows-latest4 unmodified lines node-version: ${{ matrix.node-version }} - run: npm install - run: npm test - uses: codecov/codecov-action@v2 if: matrix.os == 'ubuntu-latest' && matrix.node-version == 18 if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20 with: fail_ci_if_error: truemodified:lib/command.js+3 added-4 removed
8 unmodified lines9101112131314151617182019202122235 unmodified lines2930313234333435363740 unmodified lines7879808183828384858633 unmodified lines8 unmodified lines return [file, ...args];};
const NO_ESCAPE_REGEXP = /^[\w.-]+$/;const DOUBLE_QUOTES_REGEXP = /"/g;
const escapeArg = arg => { if (typeof arg !== 'string' || NO_ESCAPE_REGEXP.test(arg)) { return arg; }
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`; return `"${arg.replaceAll('"', '\\"')}"`;};
export const joinCommand = (file, args) => normalizeArgs(file, args).join(' ');
5 unmodified linesexport const parseCommand = command => { const tokens = []; for (const token of command.trim().split(SPACES_REGEXP)) { // Allow spaces to be escaped by a backslash if not meant as a delimiter const previousToken = tokens[tokens.length - 1]; const previousToken = tokens.at(-1); if (previousToken && previousToken.endsWith('\\')) { // Merge previous token with current one tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`; } else {40 unmodified linesconst concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [ ...tokens.slice(0, -1), `${tokens[tokens.length - 1]}${nextTokens[0]}`, `${tokens.at(-1)}${nextTokens[0]}`, ...nextTokens.slice(1), ];
const parseTemplate = ({templates, expressions, tokens, index, template}) => {33 unmodified linesmodified:test/pipe.js+1 added-1 removed
30 unmodified lines31 test('pipeAll() can pipe stdout to streams', pipeToStream, 'noop.js', 'pipeAll', 'stdout');32 test('pipeAll() can pipe stderr to streams', pipeToStream, 'noop-err.js', 'pipeAll', 'stderr');33 34 const pipeToFile = async (t, fixtureName, funcName, streamName) => {35- const file = tempfile('.txt');35+ const file = tempfile({extension: '.txt'});36 const result = await execa(fixtureName, ['test'], {all: true})[funcName](file);37 t.is(result[streamName], 'test');38 t.is(await readFile(file, 'utf8'), 'test\n');39 };39 unmodified linesmodified:test/stream.js+2 added-2 removed
16 unmodified lines17 t.is(stdout.toString(), 'foo');18 });19 20 test('pass `stdout` to a file descriptor', async t => {21- const file = tempfile('.txt');21+ const file = tempfile({extension: '.txt'});22 await execa('noop.js', ['foo bar'], {stdout: fs.openSync(file, 'w')});23 t.is(fs.readFileSync(file, 'utf8'), 'foo bar\n');24 });25 26 test('pass `stderr` to a file descriptor', async t => {27- const file = tempfile('.txt');27+ const file = tempfile({extension: '.txt'});28 await execa('noop-err.js', ['foo bar'], {stderr: fs.openSync(file, 'w')});29 t.is(fs.readFileSync(file, 'utf8'), 'foo bar\n');30 });31 225 unmodified linesmodified:test/verbose.js+1 added-1 removed
2 unmodified lines34567789101124 unmodified lines2 unmodified linesimport {setFixtureDir} from './helpers/fixtures-dir.js';
setFixtureDir();
const normalizeTimestamp = output => output.replace(/\d/g, '0');const normalizeTimestamp = output => output.replaceAll(/\d/g, '0');const testTimestamp = '[00:00:00.000]';
test('Prints command when "verbose" is true', async t => { const {stdout, stderr, all} = await execa('nested.js', [JSON.stringify({verbose: true}), 'noop.js', 'test'], {all: true});24 unmodified linesmodified:index.d.ts-2 removed
206 unmodified lines207 You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).208 209 When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `false`.210 211- *Requires Node.js 16 or later.*212-211 @example212 ```213 import {execa} from 'execa';214 721 unmodified linesmodified:package.json+13 added-10 removed
9 unmodified lines10 "email": "sindresorhus@gmail.com",11 "url": "https://sindresorhus.com"12 },13 "type": "module",14- "exports": "./index.js",14+ "exports": {15+ "types": "./index.d.ts",16+ "default": "./index.js"17+ },18 "engines": {16- "node": "^14.18.0 || ^16.14.0 || >=18.0.0"19+ "node": ">=16.17"20 },21 "scripts": {22 "test": "xo && c8 ava && tsd"23 },22 unmodified lines46 ],47 "dependencies": {48 "cross-spawn": "^7.0.3",49 "get-stream": "^6.0.1",47- "human-signals": "^4.3.0",50+ "human-signals": "^5.0.0",51 "is-stream": "^3.0.0",52 "merge-stream": "^2.0.0",53 "npm-run-path": "^5.1.0",54 "onetime": "^6.0.0",55 "signal-exit": "^3.0.7",56 "strip-final-newline": "^3.0.0"57 },58 "devDependencies": {56- "@types/node": "^18.13.0",59+ "@types/node": "^20.4.0",60 "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",63 "is-running": "^2.1.0",61- "p-event": "^5.0.1",64+ "p-event": "^6.0.0",65 "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"69 },70 "c8": {71 "reporter": [72 "text",18 unmodified linesmodified:readme.md-2 removed
711 unmodified lines712 You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).713 714 When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `false`.715 716-*Requires Node.js 16 or later.*717-716 #### windowsVerbatimArguments717 718 Type: `boolean`\719 Default: `false`103 unmodified lines