dependency-check icon indicating copy to clipboard operation
dependency-check copied to clipboard

Support the allowHashBang option

Open godfrzero opened this issue 7 years ago • 2 comments
trafficstars

detective supports an allowHashBang option, without with any bin files starting with a shebang and having a .js extension will fail with the following error:

SyntaxError: Unexpected character '#' ...

This should be configurable, IMO, and dependency-check should include an allowHashBang option to be passed to detective on invocation. Right now, no options are passed at all.

Correct me if I'm wrong or if an option already exists. Assuming that this really is a problem though, I'll try sending a PR whenever I get time.

godfrzero avatar Sep 12 '18 02:09 godfrzero

@godfrzero It is indeed a missing feature, happy to accept a PR. Since this library accepts any detective-like API, we might want to ensure the most popular detective libraries don't define this second argument for a different type and it continues to work. The other alternative is to somehow make this configurable, probably from package.json.

blakeembrey avatar Sep 12 '18 03:09 blakeembrey

I thought about it a little bit, and it seems like accepting a detectiveOpts option would make more sense. When included as a module, detectiveOpts would be an options object directly passed to the configured detective. On the CLI, the flag(s) could be --detective-opts-*, where * is the option for detective.

This would give full control to the user in choosing their detective library and options. Thoughts?

godfrzero avatar Sep 15 '18 03:09 godfrzero