Skip to content

Commit

Permalink
Revert "refactor: use console.clear to clear the log (#5700)"
Browse files Browse the repository at this point in the history
This reverts commit 7c2a36b.

`console.clear` overrides the previous content on the screen, so it
might cause confusion when users scrolls back.
  • Loading branch information
sodatea committed Jul 24, 2020
1 parent 5634825 commit f1e77a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/@vue/cli-shared-utils/lib/logger.js
@@ -1,5 +1,6 @@
const chalk = require('chalk')
const stripAnsi = require('strip-ansi')
const readline = require('readline')
const EventEmitter = require('events')

const { stopSpinner } = require('./spinner')
Expand Down Expand Up @@ -58,7 +59,10 @@ exports.error = (msg, tag = null) => {

exports.clearConsole = title => {
if (process.stdout.isTTY) {
console.clear()
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
if (title) {
console.log(title)
}
Expand Down

0 comments on commit f1e77a5

Please sign in to comment.