Commit 74df2f61 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

fixup

parent 5c78c634
......@@ -68,17 +68,15 @@ export const createProgress = (total: number, label: string) => {
const isFinished = curProgress === total
const message = `${label} (${curProgress}/${total})`
if (progressSpinner && !isFinished) {
progressSpinner.setText(message)
} else {
progressSpinner.setText(message)
progressSpinner?.stopAndPersist()
progressSpinner.setText(message)
if (isFinished) {
progressSpinner.stopAndPersist()
}
}
const clear = () => {
if (
progressSpinner &&
process.stdout.isTTY &&
// Ensure only reset and clear once to avoid set operation overflow in ora
progressSpinner.isSpinning
) {
......
......@@ -80,7 +80,8 @@ export default function createSpinner(
}
return spinner
} else {
logFn(prefixText ? prefixText + '...' : text)
text = ` ${Log.prefixes.info} ${text} `
logFn(text)
// @ts-ignore
let spinner = {
......@@ -89,14 +90,13 @@ export default function createSpinner(
text: '',
clear: '',
setText(newText: string) {
logFn(` ${Log.prefixes.info} ${newText} `)
text = ` ${Log.prefixes.info} ${newText}`
logFn(text)
},
stop: () => spinner,
stopAndPersist: () => {
const duration = process.hrtime.bigint() - progressStart
logFn(
` ${Log.prefixes.event} ${text} in ${hrtimeBigIntDurationToString(duration)}`
)
logFn(`${text} in ${hrtimeBigIntDurationToString(duration)}`)
return spinner!
},
} as ora.Ora & { setText: (text: string) => void }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment