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

jz outdated --json emits invalid json #122

Open
mike-kaufman opened this issue Oct 24, 2022 · 0 comments
Open

jz outdated --json emits invalid json #122

mike-kaufman opened this issue Oct 24, 2022 · 0 comments

Comments

@mike-kaufman
Copy link
Collaborator

running jz outdated --json emits output that is not valid json.

In particular,

  • the list of entries are not wrapped in [ and ] at the head and tail of the outpu
  • the list of entries are not delimited by commas.

See code here:

for (const result of results) {
const formatted = [];
if (dedup) {
formatted.push(result);
} else {
result.installed.forEach(version =>
formatted.push({
...result,
installed: [version],
})
);
}
if (json) logger('[');
formatted.forEach((entry, i) =>
json
? logger(
JSON.stringify(entry) + (i !== formatted.length - 1 ? ',' : '')
)
: logger(entry.packageName, entry.installed.join(' '), entry.latest)
);
if (json) logger(']');
}

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

1 participant