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

Replace chalk.reset with stripAnsi in @vue/cli-shared-utils/lib/logger.js #4842

Merged
merged 4 commits into from Nov 27, 2019

Conversation

perakerberg
Copy link
Contributor

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:
When logging multi-line logs, the logger uses chalk.reset in order to get the length of the tag for the log. This is to achieve an indented layout of multi-line logs. However, chalk.reset only replaces styles such as bold and italic, not color, see GitHub issue. When the tag contains colors, the result is not pretty. Replacing with stripAnsi gets the intended result.

I found this behavior when using the GeneratorApi.exitLog function, when building a custom preset for vue-cli. Any multi-line entry is not well-formatted, and adding multiple exitLog calls gets rather noisy, since the logger adds the preset name as the preceding tag.

Note: This introduces a new require of "strip-ansi". If that is okay or not for vue-cli, I am not sure.

When logging multi-line logs, the logger uses chalk.reset in order to get the length of the tag for the log. This is to achieve an indented layout of multi-line logs. chalk.reset only replaces styles such as bold and italic, not color. When the tag contains colors, the result is not pretty. Replacing with stripAnsi gets the intended result.
@sodatea sodatea merged commit 13376ce into vuejs:dev Nov 27, 2019
@vue-bot
Copy link

vue-bot commented Nov 27, 2019

Hey @perakerberg, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants