naugtur / npm-audit-resolver

Apache License 2.0
121 stars 28 forks source link

Allow --parseable flag for npm audit to be used #46

Closed kellymoore closed 3 years ago

kellymoore commented 3 years ago

It would be nice to be able to use the --parseable flag so that we can print out the results in pipelines. Currently when passing this flag down, the --json flag is still used and we get the following output:

➜  npx npm-audit-resolver --parseable
npx: installed 59 in 6.358s
>>>> npm audit --json --parseable
>>>> exit: 1
failed to parse output
update  lodash  high    npm update lodash --depth 7 Command Injection   https://npmjs.com/advisories/1673   node-cache>lodash   N

SyntaxError: Unexpected token i in JSON at position 0
    at JSON.parse (<anonymous>)
naugtur commented 3 years ago

Can you explain what you're trying to accomplish?

kellymoore commented 3 years ago

@naugtur the ability to run npm-audit-resolver with the --parseable flag as can be done with npm audit --parseable. The problem is --json is appended by default and overrides this, causing the error I've pasted above

naugtur commented 3 years ago

I understand what you're trying to run. I don't understand what for. Need wider context and an example.

If we define the request as "make passing --parseable work" my response is it's impossible, because npm-audit-resolver consumes json from npm audit and without it, all functionality is gone.

Please share what you're trying to accomplish and any context you find relevant

naugtur commented 3 years ago

@kellymoore I do want to help you. Please help me help you ;)