npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-task-doc

v1.0.11

Published

Make gulp task documentation (help) easy - just write javascript comments

Downloads

347

Readme

gulp-task-doc

Build Status npm version

Description

Print gulp task list by reading task comments. Output example:

$ gulp help
[11:25:58] Using gulpfile /www/gulp-task-doc/gulpfile.js
[11:25:58] Starting 'help'...
Usage: gulp [task] [task2] ...

Tasks:  
   help     Display this help
   bump     Bump the version
              --type=pre will bump the prerelease version *.*.*-x
              --type=patch or no flag will bump the patch version *.*.x
              --type=minor will bump the minor version *.x.*
              --type=major will bump the major version x.*.*
              --version=1.2.3 will bump to a specific version and ignore other flags
   jscs     Check code style
   jshint   Analise code quality
   test     Run tests
[11:25:59] Finished 'help' after 15 ms

Features

  • Support a separation of gulpfile into multiple files
  • @internal jsdoc-like tag to hide a task from help
  • @verbose jsdoc-like tag to show a task only with a --verbose argument
  • Help output can be customized

Installation

Install with npm:

npm install --save-dev gulp-task-doc

Usage

var gulp   = require('gulp-task-doc'); // Instead of require('gulp');
var jscs   = require('gulp-jscs');

// @internal
gulp.task('default', ['help']);

/**
 * Display this help
 */
gulp.task('help', gulp.help());

/**
 * Check code style
 * @verbose
 */
gulp.task('jscs', function() {
  return gulp.src(jsFiles)
    .pipe(jscs())
    .pipe(jscs.reporter());
});

/**
 * Bump the version
 * --type=pre will bump the prerelease version *.*.*-x
 * --type=patch or no flag will bump the patch version *.*.x
 * --type=minor will bump the minor version *.x.*
 * --type=major will bump the major version x.*.*
 * --version=1.2.3 will bump to a specific version and ignore other flags
 */
gulp.task('bump', function() {
  return gulp
    .src('package.json')
    .pipe(bump({
      type: args.type,
      version: args.version
    }))
    .pipe(gulp.dest(__dirname));
});

Alternative initialization

If you want to use gulp instead of gulp-task-doc to define tasks you can use a patchGulp method that uses monkey-patching to override a gulp.task method:

var gulp = require('gulp');
var doc  = require('gulp-task-doc').patchGulp();

// Display this help
gulp.task('help', doc.help());

Options

print({
  parser: { // Options for [node-comments-parser](https://github.com/megahertz/node-comments-parser)
    //...
  },
  print: function(tasks, isVerbose) { // Custom print function
    tasks = tasks
      .filterHidden(isVerbose)
      .sort();
      
    var lines = [
      'gulp [task]\n',
      'Tasks:'
    ];
    tasks.forEach(function(task) {
      lines.push('  ' + task.name);
      task.comment.lines.forEach( (line) => lines.push('    ' + line) );
    });
    return lines.join('\n');
  }
});

License

Licensed under MIT.