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')