fix: audit output (#5984)

Wrap text in `pnpm audit` output for better readability.

close #5981
This commit is contained in:
Michael Riehemann
2023-01-29 02:26:08 +01:00
committed by GitHub
parent cc591d8378
commit 2ff11e77a6
4 changed files with 3649 additions and 2499 deletions

View File

@@ -0,0 +1,7 @@
---
"@pnpm/plugin-commands-audit": patch
"@pnpm/audit": patch
pnpm: patch
---
Wrap text in `pnpm audit` output for better readability [#5981](https://github.com/pnpm/pnpm/issues/5981)

View File

@@ -109,7 +109,7 @@ async function searchPackagePaths (
function _walker (packages: PackageNode[], depPath: string) {
for (const pkg of packages) {
const nextDepPath = `${depPath}>${pkg.name}@${pkg.version}`
const nextDepPath = `${depPath} > ${pkg.name}@${pkg.version}`
if (pkg.dependencies?.length) {
_walker(pkg.dependencies, nextDepPath)
} else {

View File

@@ -28,6 +28,14 @@ const AUDIT_COLOR = {
high: chalk.bold.red,
critical: chalk.bold.red,
}
const AUDIT_TABLE_OPTIONS = TABLE_OPTIONS
AUDIT_TABLE_OPTIONS.columns = {
1: {
width: 54, // = table width of 80
wrapWord: true,
},
}
// eslint-enable
export const rcOptionsTypes = cliOptionsTypes
@@ -223,7 +231,7 @@ ${JSON.stringify(newOverrides, null, 2)}`,
['Patched versions', advisory.patched_versions],
['Paths', advisory.findings.map(({ paths }) => paths).flat().join('\n\n')],
['More info', advisory.url],
], TABLE_OPTIONS)
], AUDIT_TABLE_OPTIONS)
}
return {
exitCode: output ? 1 : 0,

View File

File diff suppressed because it is too large Load Diff