Skip to content

feat(essentials): better yarn config commands#1141

Merged
arcanis merged 17 commits into
yarnpkg:masterfrom
paul-soporan:feat/essentials/better-config
Apr 10, 2020
Merged

feat(essentials): better yarn config commands#1141
arcanis merged 17 commits into
yarnpkg:masterfrom
paul-soporan:feat/essentials/better-config

Conversation

@paul-soporan
Copy link
Copy Markdown
Member

@paul-soporan paul-soporan commented Mar 31, 2020

This PR has been updated to include the suggestions @arcanis gave me on Discord.

What's the problem this PR addresses?

Currently:

  • yarn config get doesn't correctly display values that aren't strings
  • yarn config set can only set string values

How did you fix it?

I made yarn config get display configuration values using inspect or as JSON when using the --json flag.
For displaying them as JSON, I had to implement a function that recursively converts maps to objects.


I made yarn config set accept values as JSON when using the --json flag.
When not using the --json flag, values are set as strings.
When using the --json flag, values are parsed as JSON before being set.

TODO:

  • update tests for the yarn config get command
  • add examples for the new features
  • maybe colorize the config option name in the yarn config set output. I'll let @arcanis handle this if he wants, as I'm not good at picking colors 😄

@paul-soporan paul-soporan added the in progress Features claimed by a contributor label Apr 1, 2020
@paul-soporan
Copy link
Copy Markdown
Member Author

@arcanis, I'm wondering if we should make the yarn config get <option> --json output also include the name of the option, to make it more easily parseable.

@paul-soporan paul-soporan removed the in progress Features claimed by a contributor label Apr 2, 2020
Copy link
Copy Markdown
Member

@arcanis arcanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Just a little typeof value === 'string' to add to yarn config get and it'll be good to go! 😃

Comment thread packages/plugin-essentials/sources/commands/config/get.ts
Comment thread packages/acceptance-tests/pkg-tests-specs/sources/commands/config/get.test.js Outdated
Comment thread packages/plugin-essentials/sources/commands/config/set.ts Outdated
@paul-soporan
Copy link
Copy Markdown
Member Author

BTW, shouldn't we remove the polyfills for Node 8, since we dropped support for Node 8?

@arcanis
Copy link
Copy Markdown
Member

arcanis commented Apr 10, 2020

Yep, finally 🤡

@arcanis arcanis merged commit a9b01cb into yarnpkg:master Apr 10, 2020
@paul-soporan paul-soporan deleted the feat/essentials/better-config branch April 10, 2020 22:48
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

Successfully merging this pull request may close these issues.

2 participants