sindresorhus / gulp-debug Goto Github PK
View Code? Open in Web Editor NEWDebug Vinyl file streams to see what files are run through your Gulp pipeline
License: MIT License
Debug Vinyl file streams to see what files are run through your Gulp pipeline
License: MIT License
I'm getting a syntax error when installing via npm:
node_modules/gulp-debug/index.js:2
const path = require('path');
^^^^^
SyntaxError: Use of const in strict mode.
I met this error when npm install gulp-debug
peerinvalid Peer [email protected] wants gulp@>=4
The latest gulp version is 3.9.1
. How can I install gulp@>=4?
I have to npm install gulp-debug@3
The debug plugin does not emit the names of certain files correctly
mynamespace.mymodule.js
Would be emitted by gulp-debug as " mynamspace.js"
Hi,
Your readme.md
says:
By default only relative paths are shown.
But those relatives paths are not coming from/not the same as the Vinyl file.relative.
Have been fighting to correctly setup gulp.src & gulp.dest ๐ So...
Is that intentional?
Hi,
Really nice plugin.
I see others want options for coloring outputs? It's not that hard wto add it hen people just ask for it?
I know I can change the color on my terminal but using others tools that cannot. Like Task Explorer on Visual Studio. I think it would be a nice future for UX perspective to send out debugs in different colors for different titles. I know you don't like it but it's an easy feature for you to add when ppl gladly ask for it right? It would be so awsome.
thanx, keep up the good work.
I setup gulp-debug
as a stream action of gulp-if
and this prevents the debug output EXCEPT for the summary information.
For example when run in my gulp 'copy.js.dev' plugin:
gulp.src(normalFiles)
.pipe(gulpif(debugout, debug({title:'copy.js.local normal files'})))
.pipe(gulp.dest(JS_DEST));
When condition is true:
[13:00:04] Starting 'copy.js.local.dev'...
[13:00:04] Finished 'copy.js.local.dev' after 16 ms
[13:00:04] Finished 'build.dev' after 3.77 s
[13:00:04] copy.js.local normal files dist/dev/jslocal/setup-service-worker.js
[13:00:04] copy.js.local normal files 1 item
This is correct (except there seems to be a synchronicity problem which is most likely unrelated to gulp-debug
).
When condition is false:
[13:00:49] Starting 'copy.js.local.dev'...
[13:00:49] Finished 'copy.js.local.dev' after 16 ms
[13:00:49] Finished 'build.dev' after 3.33 s
[13:00:49] copy.js.local normal files 0 items
The file is copied and because the gulp-debug
didn't fire it didn't show the file. However the summary is still printed and is zero (0) not because no file was copied but because the debug line for that file wasn't printed. Somehow this seems to sit outside the copy-if
condition. This is the issue.
"gulp-debug": "^2.1.2",
"gulp-if": "^2.0.1",
With the upcoming release of gulp4, gulp-util is deprecated. It should be replaced by dependencies on the individual components used by gulp-debug. The README lists alternatives for the different components. https://github.com/gulpjs/gulp-util
Running Gulp 3.8.11, gulp-debug 2.0.1, gulp-util-3.0.5
I am attempting to use a gulp pipe to debug in order to troubleshoot a gulp script.
When I added in .pipe(debug({title: 'Lint-ts:'})); the gulp script runner fails with
[11:53:00] TypeError: boolean is not a function
at Gulp.gulp.task.gulp.src.pipe.debug.title (D:\Dropbox\Solutions\OHI\ASPDN-Aurelia-Skeleton\src\ASPDN_Aurelia_Skeleton\Gulpfile.js:35:21)
and no output from debug() is generated. I tried with and without a title. I also am using gulp-util.Log() with no issue.
I moved to modifying a know working script added the .pipe(debug... and that also causes the previously working script to fail.
While trying to use this I get an error:
$ gulp
module.js:340
throw err;
^
Error: Cannot find module 'through2'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/oskari/node_modules/gulp-debug/index.js:3:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
What other debug output could be useful to show?
Blue is hard to read on a black background
Thanks!
It doesn't make sense to output file contents if a file is binary, such as any image file...
Some background: I have a stream that concatenates over 100 files together using gulp-concat. I'm trying to make sure these are sorted first, so I am using gulp-sort. But I wanted to check the ordering of the files which might need to be customized.
Anyway, my task looks something like this:
gulp.task('framework', function() {
var dest = 'build/ui/js', stream;
stream = gulp.src(sourcePaths.framework) // contains a couple of globs
.pipe(sort());
if(args.debug) { // set to true outside this task
stream.pipe(debug({ title: 'framework' }));
}
stream.pipe(concat('framework.js'))
.pipe(gulp.dest(dest));
return stream;
});
After 16 filenames have been output to the console, the task just stops and doesn't continue processing. If I reduce the number of files passed into src() to below 16, it seems to work fine.
You should elaborate upon the documentation a little bit. Shopping around npm, it's not clear from a quick read what the capabilities of this plugin are.
Let's say I want to show gulp
pipes debug info only when a flag is enabled:
...
.pipe(if(configs.debug, debug({title: 'js'})))
...
Is there a way to prevent gulp-debug
to show 0 items
when if condition is false? The issue is that debug
is going to be instantiated no matter what, but no files are going to pass through, hence the 0 items
. I've tried to play with lazypipe
but it feels hacky.
For now I have disabled the output when count
is zero, but I was wondering if there was a better solution for that.
Is it possible to enumerate the printed files?
is it possible to do silent mode for gulp-debug?
see gulpjs/gulp#499
If you run the following gulpfile with represented app.js (containing error) and any index.html, then index.html will be cleared.
If you remove โ.pipe(debug())โ, everything will be ok.
Doesn anybody knows why is that?
Gulpfile.js :
'use strict';
var
gulp = require('gulp'),
jshint = require('gulp-jshint'),
inject = require('gulp-inject'),
debug = require('gulp-debug');
gulp.task('jshint', function () {
gulp.src(['Gulpfile.js', 'app/js/**/*.js'])
.pipe(jshint({
quotmark: true
}))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('inject', function () {
return gulp.src('app/index.html')
.pipe(debug())
.pipe(inject(
gulp.src(['app/js/**/*.js'], {read: false}),
{
addRootSlash: false,
ignorePath: 'app'
}
))
.pipe(gulp.dest('app'))
;
});
gulp.task('inject', ['jshint'], function () {
return gulp.src('app/index.html')
.pipe(debug())
.pipe(inject(
gulp.src(['app/js/**/*.js'], {read: false}),
{
addRootSlash: false,
ignorePath: 'app'
}
))
.pipe(gulp.dest('app'))
;
});
app.js :
//'use strict';
(function (){
x
})();
please add ability to select colors
in my console I get hard to read blue
Hi, I was using debug to check my glob pattern and realized something's not working correctly.
I have a file tree as follows: (caps are folders)
-MAIN
---style1.css
---DEV
------style2.css
------style3.css
------style4.css
---DIST
------style2.min.css
------style3.min.css
------style4.min.css
I used the following glob pattern: MAIN/**/*.css
and only the files from the DEV folder got printed
I tested the same glob other ways and they all reported all files.
I tested it using the original glob plugin, I also tested it through gulp using a separate callback function - they both printed the files from both directories as expected.
Is this a bug?
Thanks,
David
I traced this down to use of is-plain-obj in stringify-object; The stat object definitely extends some prototype now:
> Object.getPrototypeOf(file.stat)
{ _checkModeProperty: [Function],
isDirectory: [Function],
isFile: [Function],
isBlockDevice: [Function],
isCharacterDevice: [Function],
isSymbolicLink: [Function],
isFIFO: [Function],
isSocket: [Function] }
I'm not sure why stringify-object is restricted to plain objects. Related issue (closed, unresolved) in stringify-object: yeoman/stringify-object#26
It would be nice if there were a mode where it only outputs a list of the files names (minus any paths to the files), or relative filesnames beyond a certain base.
Config: {base: '', title: 'unicorn'}
Output (windows FS):
unicorn Testing\style.css
unicorn Testing\sass\style.scss
Config: {base: 'Testing/', title: 'unicorn'}
Output (windows FS):
unicorn style.css
unicorn sass\style.scss
I saw the issues, but it's really annoying.
Why force us to change our terminal settings instead of just implementing the color option?
I don't know why but my debug
output is limited only to 16 lines.
My task is really simple:
gulp.task('default', function() {
gulp.src(['*/**']).pipe(debug());
});
but it lists only first 16 files. When I append another .pipe(debug());
it lists 16 more lines and so on.
I don't know it it matters but I'm using also this in my gulpfile (but not in this specific task):
var argv = require('minimist')(process.argv.slice(2));
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var flatten = require('gulp-flatten');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
var jshint = require('gulp-jshint');
var lazypipe = require('lazypipe');
var less = require('gulp-less');
var merge = require('merge-stream');
var minifyCss = require('gulp-minify-css');
var plumber = require('gulp-plumber');
var rev = require('gulp-rev');
var runSequence = require('run-sequence');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var monitorCtrlC = require('monitorctrlc');
var gutil = require('gulp-util');
var ftp = require('vinyl-ftp');
var debug = require('gulp-debug');
Looking forward to any suggestions.
Edit
I commented out everything except: argv, gulp, debug
, but it doesn't solve the problem so I belive it is some kind of debug()
limitation.
Hi. Gulp-debug is one of the coolest things I've ever seen. I am absolutely in love. Thank you for building this.
One small suggestion. Could we provide the ability to turn on and off the debug logging with a flag like:
gulp -debug-off [task-name]
I am using gulp-debut and gulp-size in a stream with gulp-changed.
If I put size() in the pipeline, it shows me the total size of the stream arriving that point.
I expected gulp-changed to remove the file names (as well as the file content) but it does not. Can you help me understand the unexpected behavior.
Would you consider explicitly exposing _log?
I am using gulp-debug
to inspect a vinyl-fs
pipeline in a server. In this case I would rather the output be printed by debug
instead of fancy-log
.
Here is what I am currently doing.
var debug = require('debug')('ciq-license-server:pipeline');
var gulpDebug = require('gulp-debug');
var stream = require('stream');
if (gulpDebug._log) {
gulpDebug._log = function() {
debug(...arguments);
};
} else {
throw new Error('gulp-debug is not exposing "_log" function');
}
module.exports = function(options) {
return debug.enabled ? gulpDebug(options) : new stream.PassThrough({objectMode: true});
};
Specifically, i have a task that looks like this:
gulp.task('copy-bower-cesium-gulp-if', function() {
var destination = buildDir('bower_libs');
return gulp
.src(
[
bowerDir('cesium', 'Cesium', '**', '*'),
bowerDir('cesium', 'CesiumUnminified', '**', '*')
],
{base: bowerDir()})
.pipe(gulpIf(argv.debug, debug({title: 'copy-bower-cesium:'})))
.pipe(gulp.dest(destination));
})
If i supply the command line arg (using yargs) --debug
:
PS > .\node\node.exe .\node_modules\gulp\bin\gulp.js copy-bower-cesium-gulp-if --debug
[14:15:34] Using gulpfile ~\project\gulpfile.js
[14:15:34] Starting 'copy-bower-cesium-gulp-if'...
[14:15:34] copy-bower-cesium: target\bower_libs\cesium\Cesium\Assets
[14:15:35] copy-bower-cesium: target\bower_libs\cesium\Cesium\Cesium.js
[14:15:35] copy-bower-cesium: target\bower_libs\cesium\Cesium\ThirdParty
...
[14:15:36] copy-bower-cesium: target\bower_libs\cesium\CesiumUnminified\Assets\Textures\NaturalEarthII\2\3\2.jpg
[14:15:36] copy-bower-cesium: target\bower_libs\cesium\CesiumUnminified\Assets\Textures\NaturalEarthII\2\3\3.jpg
[14:15:36] copy-bower-cesium: 658 items
[14:15:36] Finished 'copy-bower-cesium-gulp-if' after 1.81 s
Which is exactly what I want. However, when I dont supply --debug
, it shows 0 items:
PS > .\node\node.exe .\node_modules\gulp\bin\gulp.js copy-bower-cesium-gulp-if
[14:15:45] Using gulpfile ~\project\gulpfile.js
[14:15:45] Starting 'copy-bower-cesium-gulp-if'...
[14:15:46] copy-bower-cesium: 0 items
[14:15:47] Finished 'copy-bower-cesium-gulp-if' after 1.51 s
Hi,
I am experiencing a problem, similar to #17.
I have a simple task that copy fonts files from a folder to another.
gulp.task('build-fonts', function() {
return gulp.src(paths.fonts, { base: './' })
.pipe(gulp.dest('./dist'));
});
When I use debug mode
gulp.task('build-fonts', function() {
return gulp.src(paths.fonts, { base: './' })
.pipe(debug(gulp.dest('./dist')));
});
the files are listed, but not copied, howhever, if i remove debug, the copy works.
My paths.fonts is
fonts: ['styles/**/*.eot','styles/**/*.svg','styles/**/*.ttf','styles/**/*.woff'],
Weirdest, debug works with any other task I have in my task, but not for the fonts...
Hi,
This plugin is really awesome and useful when setting up a gulp pileline. However, I'm working with an assignment when it would be great to see the contents of the generated files as well (title isn't enough).
Would it be possible to add a "content" option to show contents? Initially this option defaults to false but can be set to true when needed.
Ideally there would be a "contentEncoding" option as well which let's me control how the content are going to be shown on the output. This can accept any of the encodings accepted by buf.toString() like 'ascii' or 'base64' but I'm happy with just plain if it's too much work.
Could you add an option to disable stdout output so the logging can be turned on and off such as with a command-line switch?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.