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-listing

v1.1.1

Published

Adds the ability to provide a task listing for your gulpfile

Downloads

41,813

Readme

gulp-task-listing

NPM version Build Status

Provides an easy way to get a listing of your tasks from your gulpfile. By default, the output groups tasks based on whether or not they contain a hyphen (-), underscore (_), or colon (:) in their name.

You can optionally override the Regexp used to determine whether a task is a primary or subtask, as well as filter out tasks you don't want to see in the output.

Usage

Install using:

npm i --save-dev gulp-task-listing

Then add it to your gulpfile like so:

var gulp = require('gulp');
var taskListing = require('gulp-task-listing');

// Add a task to render the output
gulp.task('help', taskListing);

// Add some top-level and sub tasks
gulp.task('build', ['build-js', 'build-css']);
gulp.task('build-js', function() { ... })
gulp.task('build-css', function() { ... })

gulp.task('compile', ['compile-js', 'compile-css']);
gulp.task('compile-js', function() { ... })
gulp.task('compile-css', function() { ... })

Now run gulp help, and you'll see this:

Main Tasks
------------------------------
    build
    compile
    help

Sub Tasks
------------------------------
    build-css
    build-js
    compile-css
    compile-js

Customization

You can customize the output of the task listing by using the taskListing.withFilters(subtaskFilter, excludeFilter) method. Both arguments are optional. You can pass in a string, RegExp, or a custom function.

subtaskFilter

Providing this allows you to choose which tasks are Main Tasks (by returning false), and which are Sub Tasks (by returning true).

By default, this is defined as the regular expression /[-_:]/, which means that any task with a hyphen, underscore, or colon in it's name is assumed to be a subtask.

If, for example, you wanted to only use colons to determine a task's status, you could set it up like so:

gulp.task('help', taskListing.withFilters(/:/));

If you had something more complex, you can use a function, like so:

gulp.task('help', taskListing.withFilters(function(task) {
	isSubTask = // test task name for sub task properties
	return isSubTask;
}));

excludeFilter

The exclude filter allows you to remove tasks from the listing. If you want to remove tasks that contain the word secret, you could set it up like so:

gulp.task('help', taskListing.withFilters(null, 'secret'));

If you had something more complex, you can use a function, like so:

gulp.task('help', taskListing.withFilters(null, function(task) {
	exclude = // test task name for exclusion
	return exclude;
}));

Note: setting the first argument to null allows you to retain the default behavior for subtask detection.

License

MIT License