Releases: sindresorhus/execa
Releases Β· sindresorhus/execa
v8.0.0
v7.2.0
v7.1.1
Features
- Improve error message when
$.sync(options)`command`
is used instead of$(options).sync`command`
(#551)
Bug fixes
- Fix argument concatenation when using
$`command argument${value}`
(#553) - Fix default value of the
stdin
option when using$`command`
: it should beinherit
(#550)
v7.1.0
Features
- Add
$
method to write Node.js scripts like zx. For more information, please see this blog post, this section and this page. Thanks @aaronccasanova for this great feature!
import {$} from 'execa';
const branch = await $`git branch --show-current`;
await $`dep deploy --branch=${branch}`;
- Add
.pipeStdout()
,.pipeStderr()
and.pipeAll()
methods to redirectstdout
/stderr
to a file, a stream or another process.
// Similar to `echo unicorns > stdout.txt` in Bash
await execa('echo', ['unicorns']).pipeStdout('stdout.txt');
// Similar to `echo unicorns 2> stdout.txt` in Bash
await execa('echo', ['unicorns']).pipeStderr('stderr.txt');
// Similar to `echo unicorns &> stdout.txt` in Bash
await execa('echo', ['unicorns'], {all: true}).pipeAll('all.txt');
- Add
inputFile
option to use a file asstdin
.
// Similar to `cat < stdin.txt` in Bash
const {stdout} = await execa('cat', {inputFile: 'stdin.txt'});
console.log(stdout);
//=> 'unicorns'
- Add
verbose
option to print each command onstderr
before executing it. This can also be enabled by setting theNODE_DEBUG=execa
environment variable in the current process.
> node file.js
unicorns
rainbows
> NODE_DEBUG=execa node file.js
[16:50:03.305] echo unicorns
unicorns
[16:50:03.308] echo rainbows
rainbows
v7.0.0
v6.1.0
- Support
AbortController
(#490) c6e791a - Allow
cwd
andlocalDir
options to be URLs (#492) 93ab929
v6.0.0
Breaking
- Require Node.js 12.20 (#478) 7707880
- This package is now pure ESM. Please read this.
- Moved from a default export to named exports.
require('execa')
βimport {execa} from 'execa'
require('execa').sync
βimport {execaSync} from 'execa'
require('execa').command
βimport {execaCommand} from 'execa'
require('execa').commandSync
βimport {execaCommandSync} from 'execa'
require('execa').node
βimport {execaNode} from 'execa'
v5.1.1
v5.1.0
- Add
.escapedCommand
property to the results (#466) 712bafc