@slime-man wrote:
What I Wanted to Do
machine parse about one thousand outdated reports. In the event that there are no outdated packages,
NPM should understand the--json
bit means…i am expecting json… and should return at least a'{}'
or something.What Happened Instead
If you run
npm outdated --json [--long]
in a package with no outdated dependencies,
it does not write to stdout.If someone is using
--json
, they are expecting json in the stdout. a zero-length string is not a valid JSON string.Reproduction Steps
go to literally any directory with a package.json that is fully up-to-date. run
npm outdated --json
.
''
is not a valid json string. Mind you,'""'
is, as is'{}'
. But an empty string cannot be parsed as json,
though some implementations (likejq
) are smart enough to figure it out.Details
Platform Info
npm version 6.7.0
Posts: 4
Participants: 3