Skip to content

Commit

Permalink
Revert "refactor: use nanospinner over ora"
Browse files Browse the repository at this point in the history
This reverts commit 0ad0a21.

# Conflicts:
#	package.json
#	src/print.js
  • Loading branch information
Kikobeats committed Dec 10, 2021
1 parent 92bd72d commit ebe1e7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 4 additions & 7 deletions src/print.js
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -23,25 +23,22 @@ 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

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()
}

Expand Down

0 comments on commit ebe1e7c

Please sign in to comment.