mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-30 10:38:13 -05:00
fix: update choice list not show deprecated pkg (#9214)
--------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
6
.changeset/orange-lights-wish.md
Normal file
6
.changeset/orange-lights-wish.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm update -i` should list only packages that have newer versions [#9206](https://github.com/pnpm/pnpm/issues/9206).
|
||||
@@ -48,8 +48,15 @@ export function getUpdateChoices (outdatedPkgsOfProjects: OutdatedPackage[], wor
|
||||
const finalChoices: ChoiceGroup = []
|
||||
for (const [depGroup, choiceRows] of Object.entries(groupPkgsByType)) {
|
||||
if (choiceRows.length === 0) continue
|
||||
|
||||
const rawChoices = choiceRows.map(choice => buildPkgChoice(choice, workspacesEnabled))
|
||||
const rawChoices: RawChoice[] = []
|
||||
for (const choice of choiceRows) {
|
||||
// The list of outdated dependencies also contains deprecated packages.
|
||||
// But we only want to show those dependencies that have newer versions.
|
||||
if (choice.latestManifest?.version !== choice.current) {
|
||||
rawChoices.push(buildPkgChoice(choice, workspacesEnabled))
|
||||
}
|
||||
}
|
||||
if (rawChoices.length === 0) continue
|
||||
// add in a header row for each group
|
||||
rawChoices.unshift({
|
||||
raw: header,
|
||||
@@ -82,7 +89,13 @@ export function getUpdateChoices (outdatedPkgsOfProjects: OutdatedPackage[], wor
|
||||
return finalChoices
|
||||
}
|
||||
|
||||
function buildPkgChoice (outdatedPkg: OutdatedPackage, workspacesEnabled: boolean): { raw: string[], name: string, disabled?: boolean } {
|
||||
interface RawChoice {
|
||||
raw: string[]
|
||||
name: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
function buildPkgChoice (outdatedPkg: OutdatedPackage, workspacesEnabled: boolean): RawChoice {
|
||||
const sdiff = semverDiff(outdatedPkg.wanted, outdatedPkg.latestManifest!.version)
|
||||
const nextVersion = sdiff.change === null
|
||||
? outdatedPkg.latestManifest!.version
|
||||
|
||||
Reference in New Issue
Block a user