Comparing version 1.2.2 to 1.3.0
28
index.js
@@ -21,2 +21,6 @@ 'use strict'; | ||
var loadConfigFiles = require('./lib/shared/config/load-files'); | ||
var mergeConfigToCliFlags = require('./lib/shared/config/cli-flags'); | ||
var mergeConfigToEnvFlags = require('./lib/shared/config/env-flags'); | ||
// Logging functions | ||
@@ -38,2 +42,14 @@ var logVerify = require('./lib/shared/log/verify'); | ||
v8flags: v8flags, | ||
configFiles: { | ||
'.gulp': { | ||
home: { | ||
path: '~', | ||
extensions: interpret.extensions, | ||
}, | ||
cwd: { | ||
path: '.', | ||
extensions: interpret.extensions, | ||
}, | ||
}, | ||
}, | ||
}); | ||
@@ -56,3 +72,3 @@ | ||
// Set up event listeners for logging. | ||
// Set up event listeners for logging temporarily. | ||
toConsole(log, opts); | ||
@@ -88,2 +104,10 @@ | ||
function handleArguments(env) { | ||
var cfgLoadOrder = ['home', 'cwd']; | ||
var cfg = loadConfigFiles(env.configFiles['.gulp'], cfgLoadOrder); | ||
opts = mergeConfigToCliFlags(opts, cfg); | ||
env = mergeConfigToEnvFlags(env, cfg); | ||
// Set up event listeners for logging again after configuring. | ||
toConsole(log, opts); | ||
if (opts.help) { | ||
@@ -153,3 +177,3 @@ console.log(parser.help()); | ||
// Load and execute the CLI version | ||
require(path.join(__dirname, '/lib/versioned/', range, '/'))(opts, env); | ||
require(path.join(__dirname, '/lib/versioned/', range, '/'))(opts, env, cfg); | ||
} |
@@ -8,5 +8,6 @@ 'use strict'; | ||
var sortBy = require('lodash.sortby'); | ||
var isString = require('lodash.isstring'); | ||
var isObject = require('lodash.isplainobject'); | ||
var isString = require('../is-string'); | ||
function logTasks(tree, depth, getTask) { | ||
@@ -13,0 +14,0 @@ depth = (typeof depth !== 'number') ? null : ((depth < 1) ? 1 : depth); |
@@ -16,3 +16,19 @@ 'use strict'; | ||
function cleanup(log) { | ||
levels.forEach(removeListeners); | ||
function removeListeners(level) { | ||
if (level === 'error') { | ||
log.removeListener(level, noop); | ||
log.removeListener(level, fancyLog.error); | ||
} else { | ||
log.removeListener(level, fancyLog); | ||
} | ||
} | ||
} | ||
function toConsole(log, opts) { | ||
// Remove previous listeners to enable to call this twice. | ||
cleanup(log); | ||
// Return immediately if logging is | ||
@@ -19,0 +35,0 @@ // not desired. |
@@ -10,2 +10,3 @@ 'use strict'; | ||
var logTasks = require('../../shared/log/tasks'); | ||
var isString = require('../../shared/is-string'); | ||
var logEvents = require('./log/events'); | ||
@@ -15,3 +16,3 @@ var logTasksSimple = require('./log/tasksSimple'); | ||
function execute(opts, env) { | ||
function execute(opts, env, config) { | ||
var tasks = opts._; | ||
@@ -43,3 +44,7 @@ var toRun = tasks.length ? tasks : ['default']; | ||
var tree = taskTree(gulpInst.tasks); | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
if (config.description && isString(config.description)) { | ||
tree.label = config.description; | ||
} else { | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
} | ||
return logTasks(tree, opts.depth, function(task) { | ||
@@ -46,0 +51,0 @@ return gulpInst.tasks[task].fn; |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var exit = require('../../shared/exit'); | ||
var isString = require('../../shared/is-string'); | ||
@@ -19,3 +20,3 @@ var logTasks = require('../../shared/log/tasks'); | ||
function execute(opts, env) { | ||
function execute(opts, env, config) { | ||
@@ -47,6 +48,9 @@ var tasks = opts._; | ||
if (opts.tasks) { | ||
var tree = { | ||
label: 'Tasks for ' + chalk.magenta(tildify(env.configPath)), | ||
nodes: gulpInst.tree({ deep: true }), | ||
}; | ||
var tree = {}; | ||
if (config.description && isString(config.description)) { | ||
tree.label = config.description; | ||
} else { | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
} | ||
tree.nodes = gulpInst.tree({ deep: true }); | ||
return logTasks(tree, opts.depth, function(taskname) { | ||
@@ -53,0 +57,0 @@ return gulpInst.task(taskname); |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var exit = require('../../shared/exit'); | ||
var isString = require('../../shared/is-string'); | ||
@@ -21,3 +22,3 @@ var logTasks = require('../../shared/log/tasks'); | ||
function execute(opts, env) { | ||
function execute(opts, env, config) { | ||
@@ -53,3 +54,7 @@ var tasks = opts._; | ||
tree = gulpInst.tree({ deep: true }); | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
if (config.description && isString(config.description)) { | ||
tree.label = config.description; | ||
} else { | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
} | ||
@@ -60,3 +65,7 @@ return logTasks(tree, opts.depth, getTask(gulpInst)); | ||
tree = gulpInst.tree({ deep: true }); | ||
tree.label = 'Tasks for ' + tildify(env.configPath); | ||
if (config.description && isString(config.description)) { | ||
tree.label = config.description; | ||
} else { | ||
tree.label = 'Tasks for ' + tildify(env.configPath); | ||
} | ||
@@ -63,0 +72,0 @@ var output = JSON.stringify(tree); |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var exit = require('../../shared/exit'); | ||
var isString = require('../../shared/is-string'); | ||
@@ -21,3 +22,3 @@ var logTasks = require('../../shared/log/tasks'); | ||
function execute(opts, env) { | ||
function execute(opts, env, config) { | ||
@@ -53,3 +54,7 @@ var tasks = opts._; | ||
tree = gulpInst.tree({ deep: true }); | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
if (config.description && isString(config.description)) { | ||
tree.label = config.description; | ||
} else { | ||
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); | ||
} | ||
@@ -60,3 +65,7 @@ return logTasks(tree, opts.depth, getTask(gulpInst)); | ||
tree = gulpInst.tree({ deep: true }); | ||
tree.label = 'Tasks for ' + tildify(env.configPath); | ||
if (config.description && isString(config.description)) { | ||
tree.label = config.description; | ||
} else { | ||
tree.label = 'Tasks for ' + tildify(env.configPath); | ||
} | ||
@@ -63,0 +72,0 @@ var output = JSON.stringify(tree); |
'use strict'; | ||
var isString = require('lodash.isstring'); | ||
var isObject = require('lodash.isplainobject'); | ||
var isFunction = require('lodash.isfunction'); | ||
var isString = require('../../../shared/is-string'); | ||
function getTask(gulpInst) { | ||
@@ -8,0 +9,0 @@ return function(name) { |
{ | ||
"name": "gulp-cli", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Command line interface for gulp", | ||
@@ -26,7 +26,8 @@ "author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)", | ||
"scripts": { | ||
"coveralls": "lab -r lcov | coveralls", | ||
"lint": "eslint . && jscs index.js bin/ lib/ test/", | ||
"prepublish": "marked-man --name gulp docs/CLI.md > gulp.1", | ||
"pretest": "npm run lint", | ||
"test": "lab test/*.js -cv -I Reflect", | ||
"test": "mocha --async-only --timeout 3000 test/lib test", | ||
"cover": "nyc --reporter=lcov --reporter=text-summary npm test", | ||
"coveralls": "nyc --reporter=text-lcov npm test | coveralls", | ||
"changelog": "github-changes -o gulpjs -r gulp-cli -b master -f ./CHANGELOG.md --order-semver --use-commit-body" | ||
@@ -37,9 +38,9 @@ }, | ||
"chalk": "^1.1.0", | ||
"copy-props": "^1.4.1", | ||
"fancy-log": "^1.1.0", | ||
"gulplog": "^1.0.0", | ||
"interpret": "^1.0.0", | ||
"liftoff": "^2.1.0", | ||
"liftoff": "^2.3.0", | ||
"lodash.isfunction": "^3.0.8", | ||
"lodash.isplainobject": "^4.0.4", | ||
"lodash.isstring": "^4.0.1", | ||
"lodash.sortby": "^4.5.0", | ||
@@ -58,13 +59,15 @@ "matchdep": "^1.0.0", | ||
"babel-register": "^6.5.1", | ||
"code": "^1.2.1", | ||
"coveralls": "^2.7.0", | ||
"eslint": "^1.7.3", | ||
"eslint-config-gulp": "^2.0.0", | ||
"expect": "^1.20.2", | ||
"fs-extra": "^0.26.1", | ||
"github-changes": "^1.0.1", | ||
"gulp": "gulpjs/gulp#4.0", | ||
"gulp-test-tools": "^0.6.1", | ||
"jscs": "^2.3.5", | ||
"jscs-preset-gulp": "^1.0.0", | ||
"lab": "^6.2.0", | ||
"marked-man": "^0.1.3" | ||
"marked-man": "^0.1.3", | ||
"mocha": "^3.2.0", | ||
"nyc": "^10.0.0" | ||
}, | ||
@@ -71,0 +74,0 @@ "keywords": [ |
@@ -16,3 +16,3 @@ <p align="center"> | ||
```bash | ||
> gulp [flags] tasks | ||
> gulp [flags] <task> <task>... | ||
``` | ||
@@ -56,4 +56,16 @@ | ||
Tasks can be executed by running `gulp <task> <othertask>`. Just running `gulp` will execute the task you registered called `default`. If there is no `default` task, gulp will error. | ||
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. | ||
Gulp does not serialize tasks listed on the command line. From using | ||
other comparable tools users may expect to execute something like | ||
`gulp clean build`, with tasks named `clean` and `build`. This will not | ||
produce the intended result, as the two tasks will be executed | ||
concurrently. | ||
Just running `gulp` will execute the task `default`. If there is no | ||
`default` task, gulp will error. | ||
## Completion | ||
@@ -88,2 +100,14 @@ > Thanks to the grunt team, specifically Tyler Kellen | ||
## 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 | ||
@@ -90,0 +114,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65999
39
1089
225
15
20
+ Addedcopy-props@^1.4.1
+ Addedcopy-props@1.6.0(transitive)
+ Addedeach-props@1.3.2(transitive)
- Removedlodash.isstring@^4.0.1
- Removedlodash.isstring@4.0.1(transitive)
Updatedliftoff@^2.3.0