-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
yarn outdated --json now prints invalid JSON #5021
Comments
The diff you linked does indeed seem to be what causes the additional line of output, however I think this is by design. The For example if you
So each line is a valid JSON object. Previously, @jasononeil I would recommend having whatever is processing the Yarn output find the entry with @yarnpkg/core Perhaps |
I think we can just document it's json-lines format, since that's what it's always been 🤔 |
Thanks for the clarification! The new hint in the help is perfect. |
…readdir_files * upstream/master: fix(cli): Write Node4+ error message to stderr (yarnpkg#5094) test(jest): Upgrade jest to latest available version (yarnpkg#5018) fix(git): Ignores irrelevant output from ls-remote (yarnpkg#5081) test(integration): Fix failing react-scripts test due to unexpected warning (yarnpkg#5076) feat(help) Add command descriptions to commander output (yarnpkg#5033) ci(circle): Fix cache key setup for proper node_modules sharing (yarnpkg#5060) fixed (yarnpkg#5034) fix(fetcher): offline mirror name collision w/ private registries and scopes (yarnpkg#4822) fix(add): Make semver flags compatible with versioned requests (yarnpkg#4999) [yarnpkg#5021] Add help comment to --json flag (yarnpkg#5045) fix(git): match git dependencies by name instead of whole url fix(install): connectionOptions passes in localhost as its host to prevent popup on MacOsx. (yarnpkg#5006) chore(eslint): ignore packages dir (yarnpkg#4963)
…readdir_files * upstream/master: fix(cli): Write Node4+ error message to stderr (yarnpkg#5094) test(jest): Upgrade jest to latest available version (yarnpkg#5018) fix(git): Ignores irrelevant output from ls-remote (yarnpkg#5081) test(integration): Fix failing react-scripts test due to unexpected warning (yarnpkg#5076) feat(help) Add command descriptions to commander output (yarnpkg#5033) ci(circle): Fix cache key setup for proper node_modules sharing (yarnpkg#5060) fixed (yarnpkg#5034) fix(fetcher): offline mirror name collision w/ private registries and scopes (yarnpkg#4822) fix(add): Make semver flags compatible with versioned requests (yarnpkg#4999) [yarnpkg#5021] Add help comment to --json flag (yarnpkg#5045) fix(git): match git dependencies by name instead of whole url fix(install): connectionOptions passes in localhost as its host to prevent popup on MacOsx. (yarnpkg#5006) chore(eslint): ignore packages dir (yarnpkg#4963)
…readdir_files * upstream/master: fix(cli): Write Node4+ error message to stderr (yarnpkg#5094) test(jest): Upgrade jest to latest available version (yarnpkg#5018) fix(git): Ignores irrelevant output from ls-remote (yarnpkg#5081) test(integration): Fix failing react-scripts test due to unexpected warning (yarnpkg#5076) feat(help) Add command descriptions to commander output (yarnpkg#5033) ci(circle): Fix cache key setup for proper node_modules sharing (yarnpkg#5060) fixed (yarnpkg#5034) fix(fetcher): offline mirror name collision w/ private registries and scopes (yarnpkg#4822) fix(add): Make semver flags compatible with versioned requests (yarnpkg#4999) [yarnpkg#5021] Add help comment to --json flag (yarnpkg#5045) fix(git): match git dependencies by name instead of whole url fix(install): connectionOptions passes in localhost as its host to prevent popup on MacOsx. (yarnpkg#5006) chore(eslint): ignore packages dir (yarnpkg#4963)
Just a note here, quite a few tools have to do special logic supporting NPM/YARN since this isn't a single json result. I think an array would be nicer for those supporting Yarn and NPM. Keep in mind we're passing the Bonus for devs: |
@GantMan there's a large performance tradeoff with wrapping this in an array both from Yarn's side and from the consumer side (mostly when doing streaming parsing and on large outputs). Do you think this is a huge deal? |
btw, I don't want to come off as a complainer. I'm happy to do any PRs of the above, should they be confirmed as acceptable. Just let me know |
@BYK - I can see what you're saying with streaming. For those of us who are not taking advantage of the streaming functionality, would the cost be the same? I guess I never thought of building a stream consumer for CLI output that is fast. What percentage of people are consuming the stream? Maybe I should step up my game! :) But the most important task for me is to provide functionality to the users (npm or yarn) based on their preference. So the small speed boost is more a "cool" than ideal. Keeping my code simple would be ideal, and therefore if there were a way to hit that speedy service in the knee, and get output that looks just like |
just FYI: I'm workshopping parsing the output, just look at how much work is involved for me to try to get global modules and their versions. This is relatively simple over on NPM's side. Parsing Yarn output into something useful: https://goo.gl/sUYHvQ |
Do you want to request a feature or report a bug?
A bug
What is the current behavior?
With Yarn 1.3.2, when I run
yarn outdated --json
, I get this output, which is not valid JSON:If the current behavior is a bug, please provide the steps to reproduce.
Run
yarn updated --json
What is the expected behavior?
With yarn 1.2.0, I received valid JSON as output:
Jasons-MacBook-Pro:murmur jason.oneil$ yarn outdated --json {"type":"table","data":{"head":["Package","Current","Wanted","Latest","Package Type","URL"],"body":[["autosize-input","0.4.0","exotic","exotic","dependencies","openlistings/autosize-input#d6b638fba4bd9af9ba32e3490fd317e49fcc77aa"],["babel-eslint","7.2.3","7.2.3","8.0.2","devDependencies","https://github.com/babel/babel-eslint"],["babel-preset-jest","20.0.3","20.0.3","21.2.0","devDependencies","https://github.com/facebook/jest#readme"],["eslint","4.11.0","4.12.1","4.12.1","devDependencies","https://eslint.org"],["file-loader","0.11.2","0.11.2","1.1.5","dependencies","https://github.com/webpack/file-loader"],["flow-bin","0.50.0","0.50.0","0.59.0","devDependencies","https://github.com/flowtype/flow-bin#readme"],["jest-cli","15.1.1","15.1.1","21.2.1","devDependencies","http://facebook.github.io/jest/"],["lodash","3.10.1","3.10.1","4.17.4","dependencies","https://lodash.com/"],["moment","2.19.2","2.19.3","2.19.3","dependencies","http://momentjs.com"],["node-sass","4.5.3","4.7.2","4.7.2","dependencies","https://github.com/sass/node-sass"],["pluralize","6.0.0","6.0.0","7.0.0","dependencies","https://github.com/blakeembrey/pluralize#readme"],["postcss-loader","2.0.8","2.0.9","2.0.9","dependencies","https://github.com/postcss/postcss-loader#readme"],["react","15.6.2","15.6.2","16.2.0","dependencies","https://reactjs.org/"],["react-dom","15.5.4","15.5.4","16.2.0","dependencies","https://reactjs.org/"],["react-elm-components","1.0.0","exotic","exotic","dependencies","argshook/react-elm-components#22ae945f7c757d90fcce5277c21b202619548a4e"],["react-markdown","2.5.1","2.5.1","3.1.0","dependencies","https://github.com/rexxars/react-markdown#readme"],["react-select","1.0.0-rc.10","1.0.0-rc.10","1.1.0","dependencies","https://github.com/JedWatson/react-select#readme"],["react-select-fast-filter-options","0.2.2","exotic","exotic","dependencies","cultureamp/react-select-fast-filter-options#8c48a861da327a7a3231efa15fd84a36aadbc223"],["react-test-renderer","15.6.2","15.6.2","16.2.0","dependencies","https://reactjs.org/"],["scroll-into-view-if-needed","1.4.0","1.4.1","1.4.0","dependencies","https://stipsan.github.io/scroll-into-view-if-needed"],["select2","3.5.1","3.5.1","4.0.6-rc.1","dependencies","https://select2.org"],["webpack","3.8.1","3.9.1","3.9.1","dependencies","https://github.com/webpack/webpack"],["webpack-dev-server","2.9.4","2.9.5","2.9.5","devDependencies","https://github.com/webpack/webpack-dev-server"],["webpack-sources","1.0.2","1.1.0","1.1.0","dependencies","https://github.com/webpack/webpack-sources#readme"]]}}
Please mention your node.js, yarn and operating system version.
NodeJS: 8.6.0
Yarn: 1.3.2
OS: macOS 10.13.1
I'm not familiar with the yarn internals but I wouldn't be surprised if #4519 was the breaking change: https://github.com/yarnpkg/yarn/pull/4519/files#diff-14dc529c5b6a0f489e731b3a9aaa2c97
The text was updated successfully, but these errors were encountered: