Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Dec 31, 2017
1 parent 38b9e67 commit 26226ca
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -7,6 +7,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
sudo: false
language: node_js
node_js:
- '8'
- '6'
- '4'
2 changes: 1 addition & 1 deletion gulpfile.js
@@ -1,6 +1,6 @@
'use strict';
const gulp = require('gulp');
const debug = require('./');
const debug = require('.');

gulp.task('default', () =>
gulp.src('*')
Expand Down
24 changes: 12 additions & 12 deletions index.js
Expand Up @@ -9,43 +9,43 @@ const plur = require('plur');

const prop = chalk.blue;

module.exports = opts => {
opts = Object.assign({
module.exports = options => {
options = Object.assign({
title: 'gulp-debug:',
minimal: true,
showFiles: true
}, opts);
}, options);

if (process.argv.indexOf('--verbose') !== -1) {
opts.verbose = true;
opts.minimal = false;
opts.showFiles = true;
options.verbose = true;
options.minimal = false;
options.showFiles = true;
}

let count = 0;

return through.obj((file, enc, cb) => {
if (opts.showFiles) {
if (options.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()) : '') +
(file.stat && options.verbose ? '\nstat: ' + prop(stringifyObject(file.stat, {indent: ' '}).replace(/[{}]/g, '').trim()) : '') +
'\n';

const output = opts.minimal ? prop(path.relative(process.cwd(), file.path)) : full;
const output = options.minimal ? prop(path.relative(process.cwd(), file.path)) : full;

module.exports._log(opts.title + ' ' + output);
module.exports._log(options.title + ' ' + output);
}

count++;
cb(null, file);
}, cb => {
module.exports._log(opts.title + ' ' + chalk.green(count + ' ' + plur('item', count)));
module.exports._log(options.title + ' ' + chalk.green(count + ' ' + plur('item', count)));
cb();
});
};

// Internal: Log function used by gulp-debug exposed for testing.
// Internal: Log function used by gulp-debug exposed for testing
module.exports._log = fancyLog;
20 changes: 4 additions & 16 deletions license
@@ -1,21 +1,9 @@
The MIT License (MIT)
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -27,11 +27,10 @@
"logger",
"vinyl",
"file",
"inspect",
"fs"
],
"dependencies": {
"chalk": "^1.0.0",
"chalk": "^2.3.0",
"fancy-log": "^1.3.2",
"plur": "^2.0.0",
"stringify-object": "^3.0.0",
Expand All @@ -42,8 +41,8 @@
"ava": "*",
"gulp": "^3.8.10",
"p-event": "^1.0.0",
"sinon": "^2.1.0",
"strip-ansi": "^3.0.0",
"sinon": "^4.1.3",
"strip-ansi": "^4.0.0",
"vinyl": "^2.1.0",
"xo": "*"
},
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -32,6 +32,8 @@ gulp.task('default', () =>

#### options

Type: `Object`

##### title

Type: `string`<br>
Expand Down

0 comments on commit 26226ca

Please sign in to comment.