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

feat: output json formatted errors on stdout #5716

Merged
merged 1 commit into from
Oct 19, 2022
Merged

Commits on Oct 19, 2022

  1. feat: output json formatted errors on stdout

    This also adds a new output method `outputBuffer()` which will buffer
    all output until it is flushed in the exit handler. This allows the exit
    handler to catch any errors and append them to the output when in json
    mode. This was necessary to not introduce a regression in the case of
    #2150.
    
    BREAKING CHANGE: `npm` now outputs some json errors on stdout.
    Previously `npm` would output all json formatted errors on stderr,
    making it difficult to parse as the stderr stream usually has logs
    already written to it. In the future, `npm` will differentiate between
    errors and crashes. Errors, such as `E404` and `ERESOLVE`, will be
    handled and will continue to be output on stdout. In the case of a
    crash, `npm` will log the error as usual but will not attempt to display
    it as json, even in `--json` mode. Moving a case from the category of an
    error to a crash will not be considered a breaking change. For more
    information see npm/rfcs#482.
    
    Closes #2740
    Closes npm/statusboard#589
    lukekarrys committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    6c870b4 View commit details
    Browse the repository at this point in the history