fix: substitue pretty-time with pretty-ms

This commit is contained in:
Zoltan Kochan
2021-01-25 03:31:44 +02:00
parent 48f2396505
commit 4420f9f4e7
4 changed files with 13 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/default-reporter": patch
---
Substitute pretty-time with pretty-ms.

View File

@@ -39,7 +39,6 @@
"normalize-path": "^3.0.0",
"pretty-bytes": "^5.5.0",
"pretty-ms": "^7.0.1",
"pretty-time": "^1.1.0",
"ramda": "^0.27.1",
"right-pad": "^1.0.1",
"rxjs": "^6.6.3",
@@ -51,7 +50,6 @@
"devDependencies": {
"@pnpm/logger": "^3.2.3",
"@types/normalize-path": "^3.0.0",
"@types/pretty-time": "^1.1.0",
"@types/ramda": "^0.27.35",
"@types/semver": "^7.3.4",
"delay": "^4.4.0",

View File

@@ -8,7 +8,7 @@ import {
} from './outputConstants'
import chalk = require('chalk')
import path = require('path')
import prettyTime = require('pretty-time')
import prettyTime = require('pretty-ms')
import stripAnsi = require('strip-ansi')
const NODE_MODULES = `${path.sep}node_modules${path.sep}`
@@ -89,6 +89,10 @@ export default (
return Rx.from(lifecyclePushStream)
}
function toNano (time: [number, number]) {
return (time[0] + (time[1] / 1e9)) * 1e3
}
function renderCollapsedScriptOutput (
log: LifecycleLog,
messageCache: {
@@ -111,7 +115,7 @@ function renderCollapsedScriptOutput (
updateMessageCache(log, messageCache, opts)
return `${messageCache.label}...`
}
const time = prettyTime(process.hrtime(messageCache.startTime))
const time = prettyTime(toNano(process.hrtime(messageCache.startTime)))
if (log['exitCode'] === 0) {
return `${messageCache.label}, done in ${time}`
}
@@ -179,7 +183,7 @@ function updateMessageCache (
const maxLineWidth = opts.maxWidth - prefix.length - 2 + ANSI_ESCAPES_LENGTH_OF_PREFIX
messageCache.script = `${prefix}$ ${cutLine(log['script'], maxLineWidth)}`
} else if (opts.exit) {
const time = prettyTime(process.hrtime(messageCache.startTime))
const time = prettyTime(toNano(process.hrtime(messageCache.startTime)))
if (log['exitCode'] === 0) {
messageCache.status = formatIndentedStatus(chalk.magentaBright(`Done in ${time}`))
} else {

9
pnpm-lock.yaml generated
View File

@@ -294,7 +294,6 @@ importers:
normalize-path: 3.0.0
pretty-bytes: 5.5.0
pretty-ms: 7.0.1
pretty-time: 1.1.0
ramda: 0.27.1
right-pad: 1.0.1
rxjs: 6.6.3
@@ -306,7 +305,6 @@ importers:
'@pnpm/default-reporter': 'link:'
'@pnpm/logger': 3.2.3
'@types/normalize-path': 3.0.0
'@types/pretty-time': 1.1.0
'@types/ramda': 0.27.35
'@types/semver': 7.3.4
delay: 4.4.0
@@ -321,7 +319,6 @@ importers:
'@pnpm/logger': ^3.2.3
'@pnpm/types': workspace:6.4.0
'@types/normalize-path': ^3.0.0
'@types/pretty-time': ^1.1.0
'@types/ramda': ^0.27.35
'@types/semver': ^7.3.4
ansi-diff: ^1.1.1
@@ -333,7 +330,6 @@ importers:
normalize-path: ^3.0.0
pretty-bytes: ^5.5.0
pretty-ms: ^7.0.1
pretty-time: ^1.1.0
ramda: ^0.27.1
right-pad: ^1.0.1
rxjs: ^6.6.3
@@ -4643,10 +4639,6 @@ packages:
dev: true
resolution:
integrity: sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA==
/@types/pretty-time/1.1.0:
dev: true
resolution:
integrity: sha512-XxHpS0HzYCXyXe68xazMAK4ZCaLiDUeCGtT+zdVhb2LgXX40fGPamFW8aiNYlkf6WCDc176plLyDqfYodc0r6Q==
/@types/proxyquire/1.3.28:
dev: true
resolution:
@@ -12028,6 +12020,7 @@ packages:
resolution:
integrity: sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==
/pretty-time/1.1.0:
dev: true
engines:
node: '>=4'
resolution: