Skip to content

jz outdated --json emits invalid json #122

@mike-kaufman

Description

@mike-kaufman

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(']');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions