fix(installing.commands): show only names in checkbox summary (#12393)

Closes pnpm/pnpm#12386
This commit is contained in:
tsushanth
2026-06-14 02:50:27 -07:00
committed by GitHub
parent 7cdf9f82a6
commit 8dcd9a055c
4 changed files with 25 additions and 2 deletions

View File

@@ -0,0 +1,7 @@
---
"@pnpm/installing.commands": patch
"@pnpm/deps.compliance.commands": patch
"pnpm": patch
---
Fix garbled summary line after submitting `pnpm update -i` and `pnpm audit --fix -i`. The interactive checkbox prompt previously printed every selected choice's full table row (label, current/target versions, workspace, URL) joined by commas, producing a wall of text after pressing Enter. The summary now lists only the selected package names (or vulnerability keys) by setting an explicit `short` per choice; the in-progress selection UI is unchanged.

View File

@@ -468,7 +468,7 @@ async function interactiveAuditFix (auditReport: AuditReport): Promise<AuditRepo
return auditReport
}
const flatChoices: Array<Separator | { name: string; value: string; disabled?: boolean | string }> = []
const flatChoices: Array<Separator | { name: string; value: string; short: string; disabled?: boolean | string }> = []
for (const group of choiceGroups) {
flatChoices.push(new Separator(chalk.bold(`── ${group.message} ──`)))
for (const choice of group.choices) {
@@ -478,6 +478,11 @@ async function interactiveAuditFix (auditReport: AuditReport): Promise<AuditRepo
flatChoices.push({
name: choice.message,
value: choice.value,
// Same shape as the update prompt: `name` is the rendered table
// row, but the post-submission line uses `short` per choice.
// Without this, every selected row's full table dump is comma-
// joined back to stdout.
short: choice.value,
})
}
}

View File

@@ -228,7 +228,7 @@ async function interactiveUpdate (
return 'All of your dependencies are already up to date inside the specified ranges. Use the --latest option to update the ranges in package.json'
}
const flatChoices: Array<Separator | { name: string; value: string; disabled?: boolean | string }> = []
const flatChoices: Array<Separator | { name: string; value: string; short: string; disabled?: boolean | string }> = []
for (const group of choiceGroups) {
flatChoices.push(new Separator(chalk.bold(`── ${group.message} ──`)))
for (const choice of group.choices) {
@@ -238,6 +238,11 @@ async function interactiveUpdate (
flatChoices.push({
name: choice.message,
value: choice.value,
// `name` is the rendered table row (label + versions + workspace + url)
// that lays out a single choice during selection. After submission
// @inquirer/prompts comma-joins each choice's `short`, which without
// this defaults to `name` and dumps the whole table back to stdout.
short: choice.value,
})
}
}

View File

@@ -116,10 +116,12 @@ test('interactively update', async () => {
{
name: `is-negative 1.0.0 1.0.${chalk.greenBright.bold('1')} `,
value: 'is-negative',
short: 'is-negative',
},
{
name: `micromatch 3.0.0 3.${chalk.yellowBright.bold('1.10')} `,
value: 'micromatch',
short: 'micromatch',
},
])
expect(mockCheckbox).toHaveBeenCalledWith(
@@ -165,14 +167,17 @@ test('interactively update', async () => {
{
name: `is-negative 1.0.1 ${chalk.redBright.bold('2.1.0')} `,
value: 'is-negative',
short: 'is-negative',
},
{
name: `is-positive 2.0.0 ${chalk.redBright.bold('3.1.0')} `,
value: 'is-positive',
short: 'is-positive',
},
{
name: `micromatch 3.0.0 ${chalk.redBright.bold('4.0.0')} `,
value: 'micromatch',
short: 'micromatch',
},
])
expect(mockCheckbox).toHaveBeenCalledWith(
@@ -311,6 +316,7 @@ test('interactively update should ignore dependencies from the ignoreDependencie
{
name: `micromatch 3.0.0 3.${chalk.yellowBright.bold('1.10')} `,
value: 'micromatch',
short: 'micromatch',
},
]
)