diff --git a/.github/codecov.yml b/.github/codecov.yml
new file mode 100644
index 0000000000..9454b0e716
--- /dev/null
+++ b/.github/codecov.yml
@@ -0,0 +1,3 @@
+codecov:
+ notify:
+ after_n_builds: 6
diff --git a/.github/funding.yml b/.github/funding.yml
deleted file mode 100644
index b78bf407ee..0000000000
--- a/.github/funding.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-github: sindresorhus
-tidelift: npm/execa
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 4fd774a7dd..f25cd87a75 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -5,26 +5,39 @@ on:
jobs:
test:
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
- runs-on: ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
node-version:
- - 20
+ - 22
- 18
- - 16
os:
- - ubuntu-latest
- - macos-latest
- - windows-latest
+ - ubuntu
+ - macos
+ - windows
steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-node@v3
+ - uses: actions/cache@v4
+ with:
+ path: .lycheecache
+ key: cache-lychee-${{ github.sha }}
+ restore-keys: cache-lychee-
+ - 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
- if: matrix.os == 'ubuntu-latest' && matrix.node-version == 20
+ - uses: lycheeverse/lychee-action@v1
+ with:
+ args: --cache --verbose --no-progress --include-fragments --exclude packagephobia --exclude /pull/ --exclude linkedin --exclude file:///test --exclude invalid.com '*.md' 'docs/*.md' '.github/**/*.md' '*.json' '*.js' 'lib/**/*.js' 'test/**/*.js' '*.ts' 'test-d/**/*.ts'
+ fail: true
+ if: ${{ matrix.os == 'ubuntu' && matrix.node-version == 22 }}
+ - run: npm run lint
+ - run: npm run type
+ - run: npm run unit
+ - uses: codecov/codecov-action@v4
with:
- fail_ci_if_error: true
+ token: ${{ secrets.CODECOV_TOKEN }}
+ flags: '${{ matrix.os }}, node-${{ matrix.node-version }}'
+ fail_ci_if_error: false
+ verbose: true
diff --git a/docs/api.md b/docs/api.md
new file mode 100644
index 0000000000..a5de03ec23
--- /dev/null
+++ b/docs/api.md
@@ -0,0 +1,1307 @@
+
+
+
+
+
+
+# 📔 API reference
+
+This lists all available [methods](#methods) and their [options](#options-1). This also describes the properties of the [subprocess](#subprocess), [result](#result) and [error](#execaerror) they return.
+
+## Methods
+
+### execa(file, arguments?, options?)
+
+`file`: `string | URL`\
+`arguments`: `string[]`\
+`options`: [`Options`](#options-1)\
+_Returns_: [`ResultPromise`](#return-value)
+
+Executes a command using `file ...arguments`.
+
+More info on the [syntax](execution.md#array-syntax) and [escaping](escaping.md#array-syntax).
+
+### $(file, arguments?, options?)
+
+`file`: `string | URL`\
+`arguments`: `string[]`\
+`options`: [`Options`](#options-1)\
+_Returns_: [`ResultPromise`](#return-value)
+
+Same as [`execa()`](#execafile-arguments-options) but using [script-friendly default options](scripts.md#script-files).
+
+This is the preferred method when executing multiple commands in a script file.
+
+[More info.](scripts.md)
+
+### execaNode(scriptPath, arguments?, options?)
+
+`scriptPath`: `string | URL`\
+`arguments`: `string[]`\
+`options`: [`Options`](#options-1)\
+_Returns_: [`ResultPromise`](#return-value)
+
+Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.
+Executes a Node.js file using `node scriptPath ...arguments`.
+
+This is the preferred method when executing Node.js files.
+
+[More info.](node.md)
+
+### execaSync(file, arguments?, options?)
+### $.sync(file, arguments?, options?)
+### $.s(file, arguments?, options?)
+
+`file`: `string | URL`\
+`arguments`: `string[]`\
+`options`: [`SyncOptions`](#options-1)\
+_Returns_: [`SyncResult`](#return-value)
+
+Same as [`execa()`](#execafile-arguments-options) and [`$`](#file-arguments-options) but synchronous.
+
+Returns a subprocess [`result`](#result) or throws an [`error`](#execasyncerror). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.
+
+Those methods are discouraged as they hold the CPU and lack multiple features.
+
+[More info.](execution.md#synchronous-execution)
+
+### execa\`command\`
+### $\`command\`
+### execaNode\`command\`
+### execaSync\`command\`
+### $.sync\`command\`
+### $.s\`command\`
+
+`command`: `string`\
+_Returns_: [`ResultPromise`](#return-value), [`SyncResult`](#return-value)
+
+Same as [`execa()`](#execafile-arguments-options), [`$()`](#file-arguments-options), [`execaNode()`](#execanodescriptpath-arguments-options) and [`execaSync()`](#execasyncfile-arguments-options) but using a [template string](execution.md#template-string-syntax). `command` includes both the `file` and its `arguments`.
+
+More info on the [syntax](execution.md#template-string-syntax) and [escaping](escaping.md#template-string-syntax).
+
+### execa(options)\`command\`
+### $(options)\`command\`
+### execaNode(options)\`command\`
+### execaSync(options)\`command\`
+### $.sync(options)\`command\`
+### $.s(options)\`command\`
+
+`command`: `string`\
+`options`: [`Options`](#options-1), [`SyncOptions`](#options-1)\
+_Returns_: [`ResultPromise`](#return-value), [`SyncResult`](#return-value)
+
+Same as [```execa`command` ```](#execacommand) but with [options](#options-1).
+
+[More info.](execution.md#template-string-syntax)
+
+### execa(options)
+### $(options)
+### execaNode(options)
+### execaSync(options)
+### $.sync(options)
+### $.s(options)
+
+`options`: [`Options`](#options-1), [`SyncOptions`](#options-1)\
+_Returns_: [`ExecaMethod`](#execafile-arguments-options), [`ExecaScriptMethod`](#file-arguments-options), [`ExecaNodeMethod`](#execanodescriptpath-arguments-options), [`ExecaSyncMethod`](#execasyncfile-arguments-options), [`ExecaScriptSyncMethod`](#syncfile-arguments-options)
+
+Returns a new instance of those methods but with different default [`options`](#options-1). Consecutive calls are merged to previous ones.
+
+[More info.](execution.md#globalshared-options)
+
+### parseCommandString(command)
+
+`command`: `string`\
+_Returns_: `string[]`
+
+Split a `command` string into an array. For example, `'npm run build'` returns `['npm', 'run', 'build']` and `'argument otherArgument'` returns `['argument', 'otherArgument']`.
+
+[More info.](escaping.md#user-defined-input)
+
+### sendMessage(message, sendMessageOptions?)
+
+`message`: [`Message`](ipc.md#message-type)\
+`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\
+_Returns_: `Promise`
+
+Send a `message` to the parent process.
+
+This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.
+
+[More info.](ipc.md#exchanging-messages)
+
+#### sendMessageOptions
+
+_Type_: `object`
+
+#### sendMessageOptions.strict
+
+_Type_: `boolean`\
+_Default_: `false`
+
+Throw when the other process is not receiving or listening to messages.
+
+[More info.](ipc.md#ensure-messages-are-received)
+
+### getOneMessage(getOneMessageOptions?)
+
+`getOneMessageOptions`: [`GetOneMessageOptions`](#getonemessageoptions)\
+_Returns_: [`Promise`](ipc.md#message-type)
+
+Receive a single `message` from the parent process.
+
+This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.
+
+[More info.](ipc.md#exchanging-messages)
+
+#### getOneMessageOptions
+
+_Type_: `object`
+
+#### getOneMessageOptions.filter
+
+_Type_: [`(Message) => boolean`](ipc.md#message-type)
+
+Ignore any `message` that returns `false`.
+
+[More info.](ipc.md#filter-messages)
+
+#### getOneMessageOptions.reference
+
+_Type_: `boolean`\
+_Default_: `true`
+
+Keep the subprocess alive while `getOneMessage()` is waiting.
+
+[More info.](ipc.md#keeping-the-subprocess-alive)
+
+### getEachMessage(getEachMessageOptions?)
+
+`getEachMessageOptions`: [`GetEachMessageOptions`](#geteachmessageoptions)\
+_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)
+
+Iterate over each `message` from the parent process.
+
+This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.
+
+[More info.](ipc.md#listening-to-messages)
+
+#### getEachMessageOptions
+
+_Type_: `object`
+
+#### getEachMessageOptions.reference
+
+_Type_: `boolean`\
+_Default_: `true`
+
+Keep the subprocess alive while `getEachMessage()` is waiting.
+
+[More info.](ipc.md#keeping-the-subprocess-alive)
+
+### getCancelSignal()
+
+_Returns_: [`Promise`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
+
+Retrieves the [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) shared by the [`cancelSignal`](#optionscancelsignal) option.
+
+This can only be called inside a subprocess. This requires the [`gracefulCancel`](#optionsgracefulcancel) option to be `true`.
+
+[More info.](termination.md#graceful-termination)
+
+## Return value
+
+_TypeScript:_ [`ResultPromise`](typescript.md)\
+_Type:_ `Promise