globify icon indicating copy to clipboard operation
globify copied to clipboard

Unnecessary console.log

Open bsuh opened this issue 9 years ago • 5 comments

https://github.com/BigstickCarpet/globify/blob/master/lib/index.js#L49

Why is this here? It makes outputting to stdout instead of using --outfile useless because stdout contains a command before the browserify output.

bsuh avatar Sep 06 '16 04:09 bsuh

It doesn't really make sense to use globify and output to stdout, since the whole purpose of globify is to output multiple bundles. Can you elaborate on your use-case?

JamesMessinger avatar Sep 06 '16 10:09 JamesMessinger

I just need the first feature, Windows glob support.

Features

  • Supports glob patterns for entry files - even on Windows
  • Optionally create separate browserify bundles for each entry file

bsuh avatar Sep 06 '16 17:09 bsuh

Ah, ok. That's totally valid. Thanks for the clarification.

I've always used the --outfile argument, so I've never tested writing to stdout before. But you're right; it should be supported, and the console.log() statement interferes with that. I think the best fix is to wrap the console.log() statement in an if condition, based on whether the --outfile argument is present. If it's not present, then we can assume that the user intends to output to stdout, so we shouldn't log anything else.

JamesMessinger avatar Sep 07 '16 11:09 JamesMessinger

Thanks. Your fix sounds good. Sorry if I came off as caustic in the first comment. Working with browserify and co on Windows has been problematic and I spent that day looking at more fun issues with Windows like __dirname being /foo\bar\ and such :grimacing:

bsuh avatar Sep 08 '16 23:09 bsuh

Ran across this issue today, the console.log breaks stdout when piping to other tools that expect a Browserify bundle piped into them.

bcomnes avatar Jul 24 '19 14:07 bcomnes