mirror of
https://github.com/pnpm/pnpm.git
synced 2026-06-29 18:35:18 -04:00
fix(installing.commands): show only names in checkbox summary (#12393)
Closes pnpm/pnpm#12386
This commit is contained in:
7
.changeset/fix-interactive-prompt-summary.md
Normal file
7
.changeset/fix-interactive-prompt-summary.md
Normal 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.
|
||||
7
deps/compliance/commands/src/audit/audit.ts
vendored
7
deps/compliance/commands/src/audit/audit.ts
vendored
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user