Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 19, 2019
1 parent 4a48f5a commit 72a76a2
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,42 @@
[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-4cc61e.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky)
[![Medium](https://img.shields.io/badge/%E2%80%8B-medium-4cc61e.svg?logo=medium)](https://medium.com/@ehmicky)

Work in progress.
Command execution in Gulp.js.

As opposed to
[`child_process.exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
or other plugins, `gulp-execa` uses the popular
[`execa`](https://github.com/sindresorhus/execa) library:

- [Better Windows support](https://github.com/IndigoUnited/node-cross-spawn#why),
including [shebangs](<https://en.wikipedia.org/wiki/Shebang_(Unix)>).
- Faster and more secure, as it does not use a shell (by default).
- Execution of locally installed binaries.
- Descriptive errors and configurable verbosity.
- Interleaved stdout/stderr.

Commands can be executed either directly or inside a files stream. Unlike
similar libraries, in streaming mode:

- commands are run [in parallel](https://github.com/almost/through2-concurrent),
not [serially](https://github.com/rvagg/through2).
- output can be saved either in files or in variables.

Example Gulpfile:

```js
const { task, exec, stream } = require('gulp-execa')
const { src, dest } = require('gulp')

module.exports.audit = task('npm audit')

module.exports.outdated = async function() {
await exec('npm outdated')
}

module.exports.sort = function() {
return src('**/*.txt')
.pipe(stream(({ path }) => `sort ${path}`))
.pipe(dest('sorted'))
}
```

0 comments on commit 72a76a2

Please sign in to comment.