diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/gulp-debug/index.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/gulp-debug/index.js')
-rw-r--r-- | node_modules/gulp-debug/index.js | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/node_modules/gulp-debug/index.js b/node_modules/gulp-debug/index.js index 94623fd1c..ce720ab38 100644 --- a/node_modules/gulp-debug/index.js +++ b/node_modules/gulp-debug/index.js @@ -1,44 +1,47 @@ 'use strict'; -var path = require('path'); -var gutil = require('gulp-util'); -var through = require('through2'); -var tildify = require('tildify'); -var stringifyObject = require('stringify-object'); -var chalk = require('chalk'); -var objectAssign = require('object-assign'); -var plur = require('plur'); -var prop = chalk.blue; - -module.exports = function (opts) { - opts = objectAssign({ +const path = require('path'); +const gutil = require('gulp-util'); +const through = require('through2'); +const tildify = require('tildify'); +const stringifyObject = require('stringify-object'); +const chalk = require('chalk'); +const plur = require('plur'); + +const prop = chalk.blue; + +module.exports = opts => { + opts = Object.assign({ title: 'gulp-debug:', - minimal: true + minimal: true, + showFiles: true }, opts); if (process.argv.indexOf('--verbose') !== -1) { opts.verbose = true; opts.minimal = false; + opts.showFiles = true; } - var count = 0; + let count = 0; - return through.obj(function (file, enc, cb) { - var full = - '\n' + - (file.cwd ? 'cwd: ' + prop(tildify(file.cwd)) : '') + - (file.base ? '\nbase: ' + prop(tildify(file.base)) : '') + - (file.path ? '\npath: ' + prop(tildify(file.path)) : '') + - (file.stat && opts.verbose ? '\nstat:' + prop(stringifyObject(file.stat, {indent: ' '}).replace(/[{}]/g, '').trimRight()) : '') + - '\n'; + return through.obj((file, enc, cb) => { + if (opts.showFiles) { + const full = + '\n' + + (file.cwd ? 'cwd: ' + prop(tildify(file.cwd)) : '') + + (file.base ? '\nbase: ' + prop(tildify(file.base)) : '') + + (file.path ? '\npath: ' + prop(tildify(file.path)) : '') + + (file.stat && opts.verbose ? '\nstat: ' + prop(stringifyObject(file.stat, {indent: ' '}).replace(/[{}]/g, '').trim()) : '') + + '\n'; - var output = opts.minimal ? prop(path.relative(process.cwd(), file.path)) : full; + const output = opts.minimal ? prop(path.relative(process.cwd(), file.path)) : full; - count++; - - gutil.log(opts.title + ' ' + output); + gutil.log(opts.title + ' ' + output); + } + count++; cb(null, file); - }, function (cb) { + }, cb => { gutil.log(opts.title + ' ' + chalk.green(count + ' ' + plur('item', count))); cb(); }); |