feat: print pnpm version at the end of the console output (#9108)

This commit is contained in:
Zoltan Kochan
2025-02-15 11:12:21 +01:00
committed by GitHub
parent 2a6b51f483
commit aa29bde199
3 changed files with 10 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/default-reporter": patch
"pnpm": patch
---
Print pnpm's version after the execution time at the end of the console output.

View File

@@ -1,4 +1,5 @@
import prettyMs from 'pretty-ms'
import { packageManager } from '@pnpm/cli-meta'
import { type ExecutionTimeLog } from '@pnpm/core-loggers'
import * as Rx from 'rxjs'
import { map, take } from 'rxjs/operators'
@@ -11,7 +12,7 @@ export function reportExecutionTime (
map((log) => {
return Rx.of({
fixed: true, // Without this, for some reason sometimes the progress bar is printed after the execution time
msg: `Done in ${prettyMs(log.endedAt - log.startedAt)}`,
msg: `Done in ${prettyMs(log.endedAt - log.startedAt)} using ${packageManager.name} v${packageManager.version}`,
})
})
)

View File

@@ -1,4 +1,5 @@
import { executionTimeLogger } from '@pnpm/core-loggers'
import { packageManager } from '@pnpm/cli-meta'
import { toOutput$ } from '@pnpm/default-reporter'
import { createStreamParser } from '@pnpm/logger'
import { take } from 'rxjs/operators'
@@ -49,7 +50,7 @@ test('prints execution time for install command', (done) => {
complete: () => done(),
error: done,
next: output => {
expect(output).toBe('Done in 10.8s')
expect(output).toBe(`Done in 10.8s using ${packageManager.name} v${packageManager.version}`)
},
})
})