• Stars
    star
    397
  • Rank 108,561 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Command Line Interface for gulp.

gulp-cli

NPM version Downloads Build Status AppVeyor Build Status Coveralls Status Gitter chat

Command Line Utility for Gulp

Install

npm install --global gulp-cli

Usage

> gulp [flags] <task> <task>...

Custom Metadata

When listing tasks with the gulp -T command, gulp-cli displays some custom metadata as defined upon task functions. Currently supported properties:

  • task.description - String of the description to display.
function clean() { ... }
clean.description = 'Cleans up generated files.';
  • task.flags - Object with key/value pairs being flag/description to display.
function build() { ... }
build.flags = {
  '--prod': 'Builds in production mode.'
};

Example Usage:

function build() { ... }
build.description = 'Build entire project.';
build.flags = {
  '--prod': 'Builds in production mode (minification, etc).'
};
// gulp 3.x
gulp.task('build', build);
// gulp 4.x
gulp.task(build);

Tasks

The task(s) listed on the command line will be executed. If more than one task is listed, Gulp will execute all of them concurrently, that is, as if they had all been listed as dependencies of a single task.

By default, Gulp does not serialize tasks listed on the command line. If you would like to execute tasks serially, you must specify the --series flag. e.g. gulp clean build --series

Just running gulp will execute the task default. If there is no default task, gulp will error.

Completion

Thanks to the grunt team, specifically Tyler Kellen

To enable tasks auto-completion in shell you should add eval "$(gulp --completion=shell)" in your .shellrc file.

Bash:

Add eval "$(gulp --completion=bash)" to ~/.bashrc.

Zsh:

Add eval "$(gulp --completion=zsh)" to ~/.zshrc.

Powershell:

Add Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine) to $PROFILE.

Fish:

Add gulp --completion=fish | source to ~/.config/fish/config.fish.

Compilers

You can find a list of supported languages at https://github.com/js-cli/js-interpret. If you would like to add support for a new language, send pull requests/open issues on that project.

Environment

The CLI adds process.env.INIT_CWD which is the original cwd it was launched from.

Configuration

Configuration is supported through the use of a .gulp.* file (e.g. .gulp.json, .gulp.yml). You can find a list of supported languages at https://github.com/js-cli/js-interpret.

Configuration from the home directory (~) and current working directory (cwd) are merged with cwd taking precedence.

Supported configurations properties:

Property Description
description Top-level description of the project/gulpfile (Replaces "Tasks for ~/path/of/gulpfile.js")
flags.continue Continue execution of tasks upon failure by default.
flags.compactTasks Reduce the output of task dependency tree by default.
flags.tasksDepth Set default depth of task dependency tree.
flags.gulpfile Set a default gulpfile
flags.silent Silence logging by default
flags.series Run tasks given on the CLI in series (the default is parallel)
flags.require An array of modules to require before running the gulpfile. Any relative paths will be resolved against the --cwd directory (if you don't want that behavior, use absolute paths)
flags.nodeFlags An array of flags used to forcibly respawn the process upon startup. For example, if you always want your gulpfiles to run in node's harmony mode, you can set --harmony here

Flags

gulp has very few flags to know about. All other flags are for tasks to use if needed.

Some flags only work with gulp 4 and will be ignored when invoked against gulp 3.

Flag Short Flag Description
--help -h Show this help.
--version -v Print the global and local gulp versions.
--require [path] Will require a module before running the gulpfile. This is useful for transpilers but also has other applications.
--gulpfile [path] -f Manually set path of gulpfile. Useful if you have multiple gulpfiles. This will set the CWD to the gulpfile directory as well.
--cwd [path] Manually set the CWD. The search for the gulpfile, as well as the relativity of all requires (including the `--require` flag) will be from here.
--verify [path (optional)] Will verify plugins referenced in project's package.json against the plugins blacklist.
--tasks -T Print the task dependency tree for the loaded gulpfile.
--tasks-simple Print a plaintext list of tasks for the loaded gulpfile.
--tasks-json [path] Print the task dependency tree, in JSON format, for the loaded gulpfile. The [path] argument is optional, and if given writes the JSON to the path.
--tasks-depth [number] Specify the depth of the task dependency tree to print. This flag can be used with --tasks or --tasks-json. (This flag was named --depth before but is deprecated.)
--compact-tasks Reduce the output of task dependency tree by printing only top tasks and their child tasks. This flag can be used with --tasks or --tasks-json.
--sort-tasks Will sort top tasks of task dependency tree. This flag can be used with --tasks.
--color Will force gulp and gulp plugins to display colors, even when no color support is detected.
--no-color Will force gulp and gulp plugins to not display colors, even when color support is detected.
--silent -S Suppress all gulp logging.
--continue Continue execution of tasks upon failure.
--series Run tasks given on the CLI in series (the default is parallel).
--log-level -L Set the loglevel. -L for least verbose and -LLLL for most verbose. -LLL is default.

License

MIT

More Repositories

1

gulp

A toolkit to automate & enhance your workflow
JavaScript
32,962
star
2

vinyl

Virtual file format.
JavaScript
1,272
star
3

vinyl-fs

Vinyl adapter for the file system.
JavaScript
966
star
4

liftoff

Launch your command line tool with ease.
JavaScript
840
star
5

gulp-util

[deprecated] - See https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
JavaScript
829
star
6

plugins

[Unused] Very old plugin search website
JavaScript
280
star
7

interpret

A dictionary of file extensions and associated module loaders.
JavaScript
259
star
8

undertaker

Task registry that allows composition through series/parallel methods.
JavaScript
198
star
9

glob-stream

Readable streamx interface over anymatch.
JavaScript
178
star
10

bach

Compose your async functions with elegance.
JavaScript
133
star
11

fancy-log

Log things, prefixed with a timestamp.
JavaScript
120
star
12

findup-sync

Find the first file matching a given pattern in the current directory or the nearest ancestor directory.
JavaScript
98
star
13

glob-watcher

Watch globs and execute a function upon change, with intelligent defaults for debouncing and queueing.
JavaScript
80
star
14

glob-parent

Extract the non-magic parent path from a glob string.
JavaScript
79
star
15

async-done

Allows libraries to handle various caller provided asynchronous functions uniformly. Maps promises, observables, child processes and streams, and callbacks to callback style.
JavaScript
69
star
16

gulplog

Logger for gulp and gulp plugins.
JavaScript
56
star
17

v8flags

Get available v8 and Node.js flags.
JavaScript
56
star
18

rechoir

Prepare a node environment to require files with different extensions.
JavaScript
48
star
19

replace-ext

Replaces a file extension with another one.
JavaScript
46
star
20

gulpjs.github.io

The gulp website
JavaScript
45
star
21

ordered-read-streams

Combines array of streams into one Readable stream in strict order.
JavaScript
28
star
22

now-and-later

Map over an array or object of values in parallel or series, passing each through the async iterator, with optional lifecycle hooks.
JavaScript
24
star
23

hacker

Hack on your project easily. A liftoff proof-of-concept.
JavaScript
24
star
24

flagged-respawn

A tool for respawning node binaries when special flags are present.
JavaScript
21
star
25

artwork

Artwork for the gulp project
21
star
26

empty-dir

Check if a directory is empty.
JavaScript
20
star
27

sparkles

Namespaced global event emitter.
JavaScript
20
star
28

acceptance

Acceptance test suite for plugins
19
star
29

undertaker-forward-reference

Undertaker custom registry supporting forward referenced tasks.
JavaScript
19
star
30

plugin-error

Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor reformatting.
JavaScript
19
star
31

glogg

Global logging utility.
JavaScript
18
star
32

lead

Sink your streams.
JavaScript
17
star
33

undertaker-registry

Default registry in gulp 4.
JavaScript
17
star
34

vinyl-sourcemap

Add/write sourcemaps to/from Vinyl files.
JavaScript
15
star
35

last-run

Capture and retrieve the last time a function was run
JavaScript
14
star
36

path-dirname

Node.js path.dirname() ponyfill
JavaScript
13
star
37

fined

Find a file given a declaration of locations.
JavaScript
12
star
38

async-settle

Settle an async function. It will always complete successfully with an object of the resulting state.
JavaScript
11
star
39

value-or-function

Normalize a value or function, applying extra args to the function
JavaScript
11
star
40

copy-props

Copy properties deeply between two objects
JavaScript
10
star
41

to-through

Wrap a Readable stream in a Transform stream.
JavaScript
10
star
42

semver-greatest-satisfied-range

Find the greatest satisfied semver range from an array of ranges.
JavaScript
9
star
43

mute-stdout

Mute and unmute stdout
JavaScript
9
star
44

resolve-options

Resolve an options object based on configuration.
JavaScript
9
star
45

has-gulplog

Check if gulplog is available before attempting to use it
JavaScript
9
star
46

clone-buffer

Easier Buffer cloning in node.
JavaScript
9
star
47

eslint-config-gulp

Sharable eslint config for gulp projects
JavaScript
8
star
48

async-once

Guarantee a node-style async function is only executed once.
JavaScript
8
star
49

fs-mkdirp-stream

Ensure directories exist before writing to them.
JavaScript
8
star
50

undertaker-common-tasks

Proof-of-concept custom registry that pre-defines tasks.
JavaScript
7
star
51

remove-bom-stream

Remove a UTF8 BOM at the start of the stream.
JavaScript
7
star
52

registry

[Unused] NPM on ElasticSearch
JavaScript
5
star
53

better-stats

A replacement for node's fs.Stats with more utility
JavaScript
5
star
54

theming-log

Creates a logger with theme for text decoration.
JavaScript
4
star
55

undertaker-task-metadata

Proof-of-concept custom registry that attaches metadata to each task.
JavaScript
4
star
56

replace-homedir

Replace user home in a string with another string. Useful for tildifying a path.
JavaScript
4
star
57

evented-require

Require modules and receive events.
JavaScript
3
star
58

each-props

Process object properties deeply.
JavaScript
3
star
59

vinyl-contents

Utility to read the contents of a vinyl file.
JavaScript
3
star
60

.boilerplate

The boilerplate template for gulp packages.
3
star
61

update-template

Updates a gulpjs repository to match our current scaffold.
JavaScript
3
star
62

vinyl-prepare

[deprecated] This module's API was never satisfactory and isn't used in gulp - please don't use.
JavaScript
3
star
63

parse-node-version

Turn node's process.version into something useful.
JavaScript
2
star
64

default-resolution

Get the default resolution time based on the current node version, optionally overridable
JavaScript
2
star
65

.github

GitHub template files for the gulpjs organization.
2
star
66

jscs-preset-gulp

Sharable jscs config for gulp projects
2
star
67

conventional-changelog-gulp

conventional-changelog gulp preset
JavaScript
1
star
68

emit-mapper

Re-emit events while mapping them to new names.
JavaScript
1
star