dash-licenses icon indicating copy to clipboard operation
dash-licenses copied to clipboard

Handling package-lock.json content via stdin

Open gomes89 opened this issue 1 year ago • 1 comments

When attempting to pipe the contents of an NPM package-lock.json file into the tool via stdin, the tool does not process the data correctly. The current implementation appears to rely on the filename to determine file type, which does not work when content is provided through standard input.

Expected Behavior: The tool should be able to interpret the package-lock.json format correctly when the content is piped in, regardless of the absence of a filename.

Suggested Solution: Implement an option or flag (e.g., --format json or --stdin-type package-lock) that allows users to specify the format of the input when using stdin. This would force the tool to interpret the piped content in the specified format.

gomes89 avatar Sep 09 '24 21:09 gomes89

The tool currently supports four different file format readers:

  • package-lock.json;
  • yarn.lock;
  • pnpm-lock.yaml; and
  • Flat file (with one ID/line).

Selection of the format reader is entirely based on the file name.

Adding a parameter to force the tool read the input should encourage some additional generalisation in the code.

waynebeaton avatar Sep 10 '24 03:09 waynebeaton