mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-25 15:07:06 -04:00
fix: sort keys in pnpm.onlyBuiltDependencies
This commit is contained in:
6
.changeset/tough-experts-turn.md
Normal file
6
.changeset/tough-experts-turn.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/exec.build-commands": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Sort the package names in the "pnpm.onlyBuiltDependencies" list saved by `pnpm approve-builds`.
|
||||
@@ -30,7 +30,7 @@ export async function handler (opts: ApproveBuildsCommandOpts & RebuildCommandOp
|
||||
const automaticallyIgnoredBuilds = await getAutomaticallyIgnoredBuilds(opts)
|
||||
if (automaticallyIgnoredBuilds == null) return
|
||||
const { result } = await prompt({
|
||||
choices: [...automaticallyIgnoredBuilds],
|
||||
choices: sortStrings([...automaticallyIgnoredBuilds]),
|
||||
indicator (state: any, choice: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
return ` ${choice.enabled ? '●' : '○'}`
|
||||
},
|
||||
@@ -71,20 +71,26 @@ export async function handler (opts: ApproveBuildsCommandOpts & RebuildCommandOp
|
||||
if (opts.rootProjectManifest.pnpm?.ignoredBuiltDependencies == null) {
|
||||
opts.rootProjectManifest.pnpm = {
|
||||
...opts.rootProjectManifest.pnpm,
|
||||
ignoredBuiltDependencies: ignoredPackages,
|
||||
ignoredBuiltDependencies: sortStrings(ignoredPackages),
|
||||
}
|
||||
} else {
|
||||
opts.rootProjectManifest.pnpm.ignoredBuiltDependencies.push(...ignoredPackages)
|
||||
opts.rootProjectManifest.pnpm.ignoredBuiltDependencies = sortStrings([
|
||||
...opts.rootProjectManifest.pnpm.ignoredBuiltDependencies,
|
||||
...ignoredPackages,
|
||||
])
|
||||
}
|
||||
}
|
||||
if (buildPackages.length) {
|
||||
if (opts.rootProjectManifest.pnpm?.onlyBuiltDependencies == null) {
|
||||
opts.rootProjectManifest.pnpm = {
|
||||
...opts.rootProjectManifest.pnpm,
|
||||
onlyBuiltDependencies: buildPackages,
|
||||
onlyBuiltDependencies: sortStrings(buildPackages),
|
||||
}
|
||||
} else {
|
||||
opts.rootProjectManifest.pnpm.onlyBuiltDependencies.push(...buildPackages)
|
||||
opts.rootProjectManifest.pnpm.onlyBuiltDependencies = sortStrings([
|
||||
...opts.rootProjectManifest.pnpm.onlyBuiltDependencies,
|
||||
...buildPackages,
|
||||
])
|
||||
}
|
||||
}
|
||||
if (buildPackages.length) {
|
||||
@@ -105,3 +111,7 @@ Do you approve?`,
|
||||
return rebuild.handler(opts, buildPackages)
|
||||
}
|
||||
}
|
||||
|
||||
function sortStrings (array: string[]): string[] {
|
||||
return array.sort((a, b) => a.localeCompare(b))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user