1. gulp-help
Adds a default help task to gulp and provides the ability to add custom help messages to your gulp tasks
gulp-help
Package: gulp-help
Created by: chmontgomery
Last modified: Sat, 18 Jun 2022 17:11:25 GMT
Version: 1.6.1
License: MIT
Downloads: 44,630
Repository: https://github.com/chmontgomery/gulp-help

Install

npm install gulp-help
yarn add gulp-help

gulp-help NPM version Build Status

Adds a default help task to gulp and provides the ability to add custom help messages to your gulp tasks

Install

 $ npm install --save-dev gulp-help

Usage

Before defining any tasks, add gulp help to your gulp instance

 // gulpfile.js
var gulp = require('gulp-help')(require('gulp'));

Next, define help text for each custom task

 // gulpfile.js
gulp.task('lint', 'Lints all server side js', function () {
    gulp.src('./lib/**/*.js')
      .pipe(jshint());
});

Now show that help via gulp help

New task API

gulp.task(name[, help, deps, fn, taskOptions])

name

Type: string

help

Type: string | boolean

Custom help message as a string.

If you want to hide the task from the help menu, supply false

 gulp.task('task-hidden-from-help', false, function () {
  // ...
});

However, if the --all flag is provided, even these tasks will be shown. (i.e. gulp help --all)

deps

Type: Array

fn

Type: function

taskOptions.aliases

Type: Array

List of aliases for this task

 gulp.task('version', 'prints the version.', [], function() {
  // ...
}, {
  aliases: ['v', 'V']
});

which results in

taskOptions.options

Type: Object

Object documenting options which can be passed to your task

 gulp.task('version', 'prints the version.', [], function () {
  // ...
}, {
  options: {
    'env=prod': 'description of env, perhaps with available values',
    'key=val': 'description of key & val',
    'key': 'description of key'
  }
});

which results in

require('gulp-help')(require('gulp'), options);

These are all the options available to be passed to the gulp-help instance, NOT individual tasks.

  • description - modifies the default help message
  • aliases - adds aliases to the default help task
  • hideEmpty - hide all tasks with no help message defined. Useful when including 3rd party tasks
  • hideDepsMessage - hide all task dependencies
  • afterPrintCallback - a function to run after the default help task runs

License

MIT © Chris Montgomery

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code