From afbb65495ebda92b221a8fed26bf27d346862db1 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Wed, 5 Feb 2025 23:45:26 +0100 Subject: [PATCH] fix: running approve-builds from a subdirectory of a workspace (#9048) --- .changeset/silent-dolls-call.md | 6 ++++++ exec/build-commands/src/getAutomaticallyIgnoredBuilds.ts | 2 +- exec/build-commands/src/ignoredBuilds.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/silent-dolls-call.md diff --git a/.changeset/silent-dolls-call.md b/.changeset/silent-dolls-call.md new file mode 100644 index 0000000000..8bcbbf41e1 --- /dev/null +++ b/.changeset/silent-dolls-call.md @@ -0,0 +1,6 @@ +--- +"@pnpm/exec.build-commands": patch +"pnpm": patch +--- + +`pnpm approve-builds` should work, when executed from a subdirectory of a workspace [#9042](https://github.com/pnpm/pnpm/issues/9042). diff --git a/exec/build-commands/src/getAutomaticallyIgnoredBuilds.ts b/exec/build-commands/src/getAutomaticallyIgnoredBuilds.ts index a539c7504b..366f5afdda 100644 --- a/exec/build-commands/src/getAutomaticallyIgnoredBuilds.ts +++ b/exec/build-commands/src/getAutomaticallyIgnoredBuilds.ts @@ -3,7 +3,7 @@ import { readModulesManifest } from '@pnpm/modules-yaml' import { type IgnoredBuildsCommandOpts } from './ignoredBuilds' export async function getAutomaticallyIgnoredBuilds (opts: IgnoredBuildsCommandOpts): Promise { - const modulesManifest = await readModulesManifest(opts.modulesDir ?? path.join(opts.dir, 'node_modules')) + const modulesManifest = await readModulesManifest(opts.modulesDir ?? path.join(opts.lockfileDir ?? opts.dir, 'node_modules')) if (modulesManifest == null) { return null } diff --git a/exec/build-commands/src/ignoredBuilds.ts b/exec/build-commands/src/ignoredBuilds.ts index d943bffac7..dfe1350289 100644 --- a/exec/build-commands/src/ignoredBuilds.ts +++ b/exec/build-commands/src/ignoredBuilds.ts @@ -2,7 +2,7 @@ import { type Config } from '@pnpm/config' import renderHelp from 'render-help' import { getAutomaticallyIgnoredBuilds } from './getAutomaticallyIgnoredBuilds' -export type IgnoredBuildsCommandOpts = Pick +export type IgnoredBuildsCommandOpts = Pick export const commandNames = ['ignored-builds']