Gathering detailed insights and metrics for gulp-execa
Gathering detailed insights and metrics for gulp-execa
Gathering detailed insights and metrics for gulp-execa
Gathering detailed insights and metrics for gulp-execa
npm install gulp-execa
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (87.9%)
TypeScript (12.1%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
57 Stars
1,555 Commits
5 Forks
3 Watchers
1 Branches
1 Contributors
Updated on Jun 01, 2025
Latest Version
8.0.1
Package Id
gulp-execa@8.0.1
Unpacked Size
34.31 kB
Size
11.33 kB
File Count
16
NPM Version
10.9.2
Node Version
23.10.0
Published on
Mar 29, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Gulp.js command execution for humans.
As opposed to similar plugins or to
child_process.exec()
,
this uses Execa which provides:
stdout
/stderr
gulp-execa
adds Gulp-specific features to
Execa including:
Commands can be executed either directly or inside a files stream. In streaming mode, unlike other libraries:
gulpfile.js
:
1import { pipeline } from 'node:stream/promises' 2 3import gulp from 'gulp' 4import { exec, stream, task } from 'gulp-execa' 5 6export const audit = task('npm audit') 7 8export const outdated = async () => { 9 await exec('npm outdated') 10} 11 12export const sort = () => 13 pipeline( 14 gulp.src('*.txt'), 15 stream(({ path }) => `sort ${path}`), 16 gulp.dest('sorted'), 17 )
npm install -D gulp-execa
This plugin requires Gulp 5 and Node.js >=18.18.0. It is an ES module and must
be loaded using
an import
or import()
statement,
not require()
. If TypeScript is used, it must be configured to
output ES modules,
not CommonJS.
Returns a Gulp task that executes command
.
1import { task } from 'gulp-execa' 2 3export const audit = task('npm audit')
Executes command
. The return value is both a promise and a
child_process
instance.
The promise will be resolved with the
command result. If
the command failed, the promise will be rejected with a nice
error. If the
reject: false
option was used,
the promise will be resolved with that error instead.
1import { exec } from 'gulp-execa' 2 3export const outdated = async () => { 4 await exec('npm outdated') 5}
Returns a stream that executes a command
on each input file.
function
must:
file.path
but
other properties
are available as well.command
stringoptions
object with a command
propertyundefined
1import { pipeline } from 'node:stream/promises' 2 3import gulp from 'gulp' 4import { stream } from 'gulp-execa' 5 6export const sort = () => 7 pipeline( 8 gulp.src('*.txt'), 9 stream(({ path }) => `sort ${path}`), 10 gulp.dest('sorted'), 11 )
Each file in the stream will spawn a separate process. This can consume lots of resources so you should only use this method when there are no alternatives such as:
The debug
,
stdout
,
stderr
,
all
and
stdio
options cannot be used
with this method.
By default no shell interpreter (like Bash or cmd.exe
) is used. This means
command
must be just the program and its arguments. No escaping/quoting is
needed, except for significant spaces (with a backslash).
Shell features such as globbing, variables and operators (like &&
>
;
)
should not be used. All of this can be done directly in Node.js instead.
Shell interpreters are slower, less secure and less cross-platform. However, you
can still opt-in to using them with the
shell
option.
1import { writeFileStream } from 'node:fs' 2 3import gulp from 'gulp' 4import { task } from 'gulp-execa' 5 6// Wrong 7// export const check = task('npm audit && npm outdated') 8 9// Correct 10export const check = gulp.series(task('npm audit'), task('npm outdated')) 11 12// Wrong 13// export const install = task('npm install > log.txt') 14 15// Correct 16export const install = task('npm install', { 17 stdout: writeFileStream('log.txt'), 18})
options
is an optional object.
All Execa options can be used. Please refer to its documentation for a list of possible options.
The following options are available as well.
Type: boolean
Default: debug
option's value
Whether the command
should be printed on the console.
1$ gulp audit 2[13:09:39] Using gulpfile ~/code/gulpfile.js 3[13:09:39] Starting 'audit'... 4[13:09:39] [gulp-execa] npm audit 5[13:09:44] Finished 'audit' after 4.96 s
Type: boolean
Default: true
for task()
and
exec()
, false
for
stream()
.
Whether both the command
and its output (stdout
/stderr
) should be printed
on the console instead of being returned in JavaScript.
1$ gulp audit 2[13:09:39] Using gulpfile ~/code/gulpfile.js 3[13:09:39] Starting 'audit'... 4[13:09:39] [gulp-execa] npm audit 5 6 == npm audit security report === 7 8found 0 vulnerabilities 9 in 27282 scanned packages 10[13:09:44] Finished 'audit' after 4.96 s
Type: string
Value: 'replace'
or 'save'
Default: 'replace'
With stream()
, whether the command result should:
replace
the file's contentssave
: be pushed
to the file.execa
array property1import { pipeline } from 'node:stream/promises' 2 3import gulp from 'gulp' 4import { stream } from 'gulp-execa' 5import through from 'through2' 6 7export const task = () => 8 pipeline( 9 gulp.src('*.js'), 10 // Prints the number of lines of each file 11 stream(({ path }) => `wc -l ${path}`, { result: 'save' }), 12 through.obj((file, encoding, func) => { 13 console.log(file.execa[0].stdout) 14 func(null, file) 15 }), 16 )
Type: string
Value: 'stdout'
, 'stderr'
or 'all'
Default: 'stdout'
Which output stream to use with result: 'replace'
.
1import { pipeline } from 'node:stream/promises' 2 3import gulp from 'gulp' 4import { stream } from 'gulp-execa' 5import through from 'through2' 6 7export const task = () => 8 pipeline( 9 gulp.src('*.js'), 10 // Prints the number of lines of each file, including `stderr` 11 stream(({ path }) => `wc -l ${path}`, { result: 'replace', from: 'all' }), 12 through.obj((file, encoding, func) => { 13 console.log(file.contents.toString()) 14 func(null, file) 15 }), 16 )
Type: integer
Default: 100
With stream()
, how many commands to run in parallel
at once.
For any question, don't hesitate to submit an issue on GitHub.
Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.
This project was made with ❤️. The simplest way to give back is by starring and sharing it online.
If the documentation is unclear or has a typo, please click on the page's Edit
button (pencil icon) and suggest a correction.
If you would like to help us fix a bug or add a new feature, please check our guidelines. Pull requests are welcome!
Thanks go to our wonderful contributors:
ehmicky 💻 🎨 🤔 📖 | Jonathan Haines 🐛 |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
7 existing vulnerabilities detected
Details
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More