Skip to content

Commit

Permalink
Require Node.js 18
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 27, 2023
1 parent 0d038e0 commit 834e372
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 38 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ jobs:
node-version:
- 20
- 18
- 16
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
with:
fail_ci_if_error: true
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export type Options<EncodingType extends EncodingOption = DefaultEncodingOption>
If the input is a file, use the `inputFile` option instead.
*/
readonly input?: string | Buffer | ReadableStream;
readonly input?: string | Uint8Array | ReadableStream;

/**
Use a file as input to the the `stdin` of your binary.
Expand All @@ -295,7 +295,7 @@ export type SyncOptions<EncodingType extends EncodingOption = DefaultEncodingOpt
If the input is a file, use the `inputFile` option instead.
*/
readonly input?: string | Buffer;
readonly input?: string | Uint8Array;

/**
Use a file as input to the the `stdin` of your binary.
Expand Down
14 changes: 2 additions & 12 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {createReadStream, readFileSync} from 'node:fs';
import {setTimeout} from 'node:timers/promises';
import {isStream} from 'is-stream';
import getStream, {getStreamAsBuffer} from 'get-stream';
import mergeStream from 'merge-stream';
import mergeStreams from '@sindresorhus/merge-streams';

const validateInputOptions = input => {
if (input !== undefined) {
Expand Down Expand Up @@ -60,17 +60,7 @@ export const makeAllStream = (spawned, {all}) => {
return;
}

const mixed = mergeStream();

if (spawned.stdout) {
mixed.add(spawned.stdout);
}

if (spawned.stderr) {
mixed.add(spawned.stderr);
}

return mixed;
return mergeStreams([spawned.stdout, spawned.stderr].filter(Boolean));
};

// On failure, `result.stdout|stderr|all` should contain the currently buffered stream
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"default": "./index.js"
},
"engines": {
"node": ">=16.17"
"node": ">=18"
},
"scripts": {
"test": "xo && c8 ava && tsd"
Expand Down Expand Up @@ -45,27 +45,27 @@
"zx"
],
"dependencies": {
"@sindresorhus/merge-streams": "^1.0.0",
"cross-spawn": "^7.0.3",
"get-stream": "^8.0.1",
"human-signals": "^5.0.0",
"is-stream": "^3.0.0",
"merge-stream": "^2.0.0",
"npm-run-path": "^5.1.0",
"onetime": "^6.0.0",
"signal-exit": "^4.1.0",
"strip-final-newline": "^3.0.0"
},
"devDependencies": {
"@types/node": "^20.4.0",
"ava": "^5.2.0",
"@types/node": "^20.8.9",
"ava": "^5.3.1",
"c8": "^8.0.1",
"get-node": "^14.2.0",
"get-node": "^14.2.1",
"is-running": "^2.1.0",
"p-event": "^6.0.0",
"path-key": "^4.0.0",
"tempfile": "^5.0.0",
"tsd": "^0.28.1",
"xo": "^0.55.0"
"tsd": "^0.29.0",
"xo": "^0.56.0"
},
"c8": {
"reporter": [
Expand Down
14 changes: 1 addition & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ If the spawned process fails, [`error.stdout`](#stdout), [`error.stderr`](#stder

#### input

Type: `string | Buffer | stream.Readable`
Type: `string | Uint8Array | stream.Readable`

Write some input to the `stdin` of your binary.\
Streams are not allowed when using the synchronous methods.
Expand Down Expand Up @@ -808,15 +808,3 @@ await execa(binPath);

- [Sindre Sorhus](https://github.com/sindresorhus)
- [@ehmicky](https://github.com/ehmicky)

---

<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-execa?utm_source=npm-execa&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

0 comments on commit 834e372

Please sign in to comment.