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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Replace chalk.reset with stripAnsi
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.
  • Loading branch information
perakerberg authored Nov 13, 2019
commit e6d539aee09521e104e7e4a42bd9753f47bd35a4
3 changes: 2 additions & 1 deletion packages/@vue/cli-shared-utils/lib/logger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const chalk = require('chalk')
const stripAnsi = require('strip-ansi');
perakerberg marked this conversation as resolved.
Show resolved Hide resolved
const readline = require('readline')
const padStart = require('string.prototype.padstart')
const EventEmitter = require('events')
Expand All @@ -19,7 +20,7 @@ const format = (label, msg) => {
return msg.split('\n').map((line, i) => {
return i === 0
? `${label} ${line}`
: padStart(line, chalk.reset(label).length)
: padStart(line, stripAnsi(label).length)
}).join('\n')
}

Expand Down