Skip to content

Commit 6eedf82

Browse files
KSXGitHubzkochan
authored andcommitted
fix: filter on pnpm-workspace.yaml (pnpm#10127)
* fix: `filter` on `pnpm-workspace.yaml` * docs: changeset * fix: actual fix * fix: don't set default on config
1 parent 7ea82ff commit 6eedf82

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.changeset/strong-readers-think.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pnpm/config": patch
3+
"pnpm": patch
4+
---
5+
6+
Fix a bug in which specifying `filter` on `pnpm-workspace.yaml` would cause pnpm to not detect any projects.

config/config/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export async function getConfig (opts: {
367367
if (pnpmConfig.workspaceDir != null) {
368368
const workspaceManifest = await readWorkspaceManifest(pnpmConfig.workspaceDir)
369369

370-
pnpmConfig.workspacePackagePatterns = cliOptions['workspace-packages'] as string[] ?? workspaceManifest?.packages ?? ['.']
370+
pnpmConfig.workspacePackagePatterns = cliOptions['workspace-packages'] as string[] ?? workspaceManifest?.packages
371371
if (workspaceManifest) {
372372
const newSettings = Object.assign(getOptionsFromPnpmSettings(pnpmConfig.workspaceDir, workspaceManifest, pnpmConfig.rootProjectManifest), configFromCliOpts)
373373
for (const [key, value] of Object.entries(newSettings)) {

pnpm/test/recursive/misc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ test('recursive command with filter from config', async () => {
314314
])
315315

316316
fs.writeFileSync('package.json', '{}', 'utf8')
317-
fs.writeFileSync('.npmrc', 'filter=project-1 project-2', 'utf8')
317+
writeYamlFile('pnpm-workspace.yaml', {
318+
filter: ['project-1', 'project-2'],
319+
})
318320
await execPnpm(['recursive', 'install'])
319321

320322
projects['project-1'].has('is-positive')

0 commit comments

Comments
 (0)