mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-22 15:20:33 -06:00
31 lines
499 B
JavaScript
31 lines
499 B
JavaScript
const ora = require('ora')
|
|
|
|
const spinner = ora()
|
|
let lastMsg
|
|
|
|
exports.logWithSpinner = (symbol, msg) => {
|
|
if (lastMsg) {
|
|
spinner.stopAndPersist({
|
|
symbol: lastMsg.symbol,
|
|
text: lastMsg.text
|
|
})
|
|
}
|
|
spinner.text = ' ' + msg
|
|
lastMsg = {
|
|
symbol: symbol + ' ',
|
|
text: msg
|
|
}
|
|
spinner.start()
|
|
}
|
|
|
|
exports.stopSpinner = () => {
|
|
if (lastMsg) {
|
|
spinner.stopAndPersist({
|
|
symbol: lastMsg.symbol,
|
|
text: lastMsg.text
|
|
})
|
|
} else {
|
|
spinner.stop()
|
|
}
|
|
}
|