From 6eedf828b4e468a77cecc2727397057b0238fa0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Mon, 27 Oct 2025 19:36:35 +0700 Subject: [PATCH] fix: `filter` on `pnpm-workspace.yaml` (#10127) * fix: `filter` on `pnpm-workspace.yaml` * docs: changeset * fix: actual fix * fix: don't set default on config --- .changeset/strong-readers-think.md | 6 ++++++ config/config/src/index.ts | 2 +- pnpm/test/recursive/misc.ts | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/strong-readers-think.md diff --git a/.changeset/strong-readers-think.md b/.changeset/strong-readers-think.md new file mode 100644 index 0000000000..1a9aa70b24 --- /dev/null +++ b/.changeset/strong-readers-think.md @@ -0,0 +1,6 @@ +--- +"@pnpm/config": patch +"pnpm": patch +--- + +Fix a bug in which specifying `filter` on `pnpm-workspace.yaml` would cause pnpm to not detect any projects. diff --git a/config/config/src/index.ts b/config/config/src/index.ts index 12649a22ee..2a04b793c6 100644 --- a/config/config/src/index.ts +++ b/config/config/src/index.ts @@ -367,7 +367,7 @@ export async function getConfig (opts: { if (pnpmConfig.workspaceDir != null) { const workspaceManifest = await readWorkspaceManifest(pnpmConfig.workspaceDir) - pnpmConfig.workspacePackagePatterns = cliOptions['workspace-packages'] as string[] ?? workspaceManifest?.packages ?? ['.'] + pnpmConfig.workspacePackagePatterns = cliOptions['workspace-packages'] as string[] ?? workspaceManifest?.packages if (workspaceManifest) { const newSettings = Object.assign(getOptionsFromPnpmSettings(pnpmConfig.workspaceDir, workspaceManifest, pnpmConfig.rootProjectManifest), configFromCliOpts) for (const [key, value] of Object.entries(newSettings)) { diff --git a/pnpm/test/recursive/misc.ts b/pnpm/test/recursive/misc.ts index 89dff9b3fe..52e1e42e23 100644 --- a/pnpm/test/recursive/misc.ts +++ b/pnpm/test/recursive/misc.ts @@ -314,7 +314,9 @@ test('recursive command with filter from config', async () => { ]) fs.writeFileSync('package.json', '{}', 'utf8') - fs.writeFileSync('.npmrc', 'filter=project-1 project-2', 'utf8') + writeYamlFile('pnpm-workspace.yaml', { + filter: ['project-1', 'project-2'], + }) await execPnpm(['recursive', 'install']) projects['project-1'].has('is-positive')