fix(config): Always output JSON format in yarn config list#4708
fix(config): Always output JSON format in yarn config list#4708sreeramjayan wants to merge 3 commits intoyarnpkg:masterfrom sreeramjayan:4496
yarn config list#4708Conversation
|
Can you share a pic of before/after? |
src/cli/commands/config.js
Outdated
|
|
||
| reporter.info(reporter.lang('configYarn')); | ||
| reporter.inspect(config.registries.yarn.config); | ||
| reporter.inspect(JSON.stringify(config.registries.yarn.config, null, 2)); |
There was a problem hiding this comment.
I think you should use reporter.log at this point with the {force: true} option.
|
Hey, thanks a lot for the PR! A test case would be great if you can add it. A simple integration test in Also having a proper title for the PR would be great. We use the following format: |
|
@sreeramjayan let me know if you need any help with the tests 😄 |
|
@BYK I did make the requested changes but am facing an issue coming up with the test case. The issue seems to be that the output of running yarn config list isn't JSON since we get the results of the yarn and npm config. I changed the PR's summary and title as well. |
yarn config list
|
Sorry for the late response and thanks a lot for the updates!
I think you can get a "pure" JSON string if you run |
arcanis
left a comment
There was a problem hiding this comment.
I would also like a screenshot :)
The main interest of inspect is that it comes with colors, so I believe that using a basic JSON serializer will actually add a bug.
|
@arcanis Here are the before and after screen shots. As you mentioned the formatting is off when the string is serialized. Any ideas on what can be done regarding this? Since the some of the keys don't have hyphens they aren't formatted as the other keys are. |
|
Hi! I'm really grateful for the work you put in this PR, but unfortunately the project moved forward since you submitted it and I fear it can be merged in this current state. I'm going to close it, but please feel free to check if the problem still exists, and to rebase your work on top of the current master and open a new PR if it's the case. Again, sorry we didn't got around merging it sooner! |


Summary
Fixes #4496.
Used
JSON.stringifyto ensure the output of yarn config list displays JSON.Test plan
New integration test to validate JSON output.