Replace chalk.reset with stripAnsi in @vue/cli-shared-utils/lib/logger.js #4842
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
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.