DEV Community

ehmicky
ehmicky

Posted on

2 1

Gulp.js command execution for humans.

Build automation in JavaScript has gotten too complicated. It's time to bring it back to simple terminal commands executed in order, using Gulp-execa.

As opposed to similar plugins or to child_process.exec(), this uses execa which provides:

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:

Example gulpfile.js:

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

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

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

module.exports.sort = () =>
  src('*.txt')
    .pipe(stream(({ path }) => `sort ${path}`))
    .pipe(dest('sorted'))
Enter fullscreen mode Exit fullscreen mode

The full documentation is available on GitHub.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay