diff --git a/.changeset/serious-schools-perform.md b/.changeset/serious-schools-perform.md new file mode 100644 index 0000000000..ed72c655ab --- /dev/null +++ b/.changeset/serious-schools-perform.md @@ -0,0 +1,5 @@ +--- +"@pnpm/exec.build-commands": patch +--- + +`approve-builds` command gets the auto-ignore build list and exits early when it is an empty array [#9024](https://github.com/pnpm/pnpm/pull/9024). diff --git a/exec/build-commands/src/approveBuilds.ts b/exec/build-commands/src/approveBuilds.ts index 89a5c5430f..b2a6312175 100644 --- a/exec/build-commands/src/approveBuilds.ts +++ b/exec/build-commands/src/approveBuilds.ts @@ -1,4 +1,5 @@ import { type Config } from '@pnpm/config' +import { globalInfo } from '@pnpm/logger' import { readProjectManifest } from '@pnpm/read-project-manifest' import renderHelp from 'render-help' import { prompt } from 'enquirer' @@ -28,7 +29,10 @@ export function rcOptionsTypes (): Record { export async function handler (opts: ApproveBuildsCommandOpts & RebuildCommandOpts): Promise { if (opts.rootProjectManifest == null) return const automaticallyIgnoredBuilds = await getAutomaticallyIgnoredBuilds(opts) - if (automaticallyIgnoredBuilds == null) return + if (!automaticallyIgnoredBuilds?.length) { + globalInfo('There are no packages awaiting approval') + return + } const { result } = await prompt({ choices: sortStrings([...automaticallyIgnoredBuilds]), indicator (state: any, choice: any) { // eslint-disable-line @typescript-eslint/no-explicit-any