Skip to content

Commit

Permalink
reset spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 21, 2024
1 parent 34e57b6 commit 14cb351
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/next/src/build/spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@ export default function createSpinner(
const origStopAndPersist = spinner.stopAndPersist.bind(spinner)

const logHandle = (method: any, args: any[]) => {
origStop()
// Enter a new line before logging new message, to avoid
// the new message shows up right after the spinner in the saem line.
console.log()
const isInProgress = spinner?.isSpinning
if (spinner && isInProgress) {
spinner.prefixText = '\r'
spinner.text = '\r'
progressSpinner.clear()
origStop()
}
method(...args)
spinner!.start()
if (spinner && isInProgress) {
spinner!.start()
}
}

console.log = (...args: any) => logHandle(origLog, args)
Expand Down

0 comments on commit 14cb351

Please sign in to comment.