diff --git a/package.json b/package.json index 5da7dbe..c8dd254 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "got": "~11.8.3", "jsome": "~2.5.0", "meow": "~9.0.0", - "nanospinner": "~0.6.0", - "picocolors": "~1.0.0", + "ora": "~5.4.0", + "picocolors": "~0.2.1", "pretty-bytes": "~5.6.0", "pretty-ms": "~7.0.1", "temperment": "~1.0.0", diff --git a/src/print.js b/src/print.js index bfa52ab..8b0fc30 100644 --- a/src/print.js +++ b/src/print.js @@ -1,12 +1,12 @@ 'use strict' -const { createSpinner } = require('nanospinner') const terminalLink = require('terminal-link') const prettyBytes = require('pretty-bytes') const prettyMs = require('pretty-ms') const colors = require('picocolors') const termImg = require('term-img') const jsome = require('jsome') +const ora = require('ora') jsome.colors = { num: 'cyan', @@ -23,7 +23,7 @@ jsome.colors = { module.exports = { spinner: (text = '') => { - const spinner = createSpinner(text, { color: 'white' }) + const spinner = ora({ color: 'white', text }) const now = Date.now() const elapsedTime = () => Date.now() - now let interval @@ -31,17 +31,14 @@ module.exports = { const start = () => { interval = setInterval(() => { const duration = elapsedTime() - if (duration > 500) { - spinner.update({ text: `${prettyMs(duration)} ${text}` }) - } + if (duration > 500) spinner.text = `${prettyMs(duration)} ${text}` }, 100) spinner.start() } const stop = () => { + spinner.stop() clearInterval(interval) - spinner.clear() - process.stderr.write('\u001B[?25h') return elapsedTime() }