Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling package-lock.json content via stdin #373

Open
gomes89 opened this issue Sep 9, 2024 · 1 comment
Open

Handling package-lock.json content via stdin #373

gomes89 opened this issue Sep 9, 2024 · 1 comment

Comments

@gomes89
Copy link
Contributor

gomes89 commented Sep 9, 2024

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.

@waynebeaton
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants