mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-31 21:42:15 -04:00
revert: "fix: allow pnpm run -r to work with empty pnpm-workspace.yaml (#10578)
* revert: "fix: allow pnpm `run -r` to work with empty pnpm-workspace.yaml (#10520)" This reverts commitf1cb40c4e1. * revert: "test: fix" This reverts commit1dbbffb6ad. * docs: add changeset close #10571
This commit is contained in:
8
.changeset/upset-badgers-dance.md
Normal file
8
.changeset/upset-badgers-dance.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
"@pnpm/config": patch
|
||||||
|
"pnpm": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Reverted a fix shipped in v10.29.1, which caused another issue [#10571](https://github.com/pnpm/pnpm/issues/10571).
|
||||||
|
Reverted fix: Fixed pnpm run -r failing with "No projects matched the filters" when an empty pnpm-workspace.yaml exists [#10497](https://github.com/pnpm/pnpm/issues/10497).
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ export async function getConfig (opts: {
|
|||||||
if (pnpmConfig.workspaceDir != null) {
|
if (pnpmConfig.workspaceDir != null) {
|
||||||
const workspaceManifest = await readWorkspaceManifest(pnpmConfig.workspaceDir)
|
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) {
|
if (workspaceManifest) {
|
||||||
const newSettings = Object.assign(getOptionsFromPnpmSettings(pnpmConfig.workspaceDir, workspaceManifest, pnpmConfig.rootProjectManifest), configFromCliOpts)
|
const newSettings = Object.assign(getOptionsFromPnpmSettings(pnpmConfig.workspaceDir, workspaceManifest, pnpmConfig.rootProjectManifest), configFromCliOpts)
|
||||||
for (const [key, value] of Object.entries(newSettings)) {
|
for (const [key, value] of Object.entries(newSettings)) {
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export async function main (inputArgv: string[]): Promise<void> {
|
|||||||
const relativeWSDirPath = () => path.relative(process.cwd(), wsDir) || '.'
|
const relativeWSDirPath = () => path.relative(process.cwd(), wsDir) || '.'
|
||||||
if (config.workspaceRoot) {
|
if (config.workspaceRoot) {
|
||||||
filters.push({ filter: `{${relativeWSDirPath()}}`, followProdDepsOnly: Boolean(config.filterProd.length) })
|
filters.push({ filter: `{${relativeWSDirPath()}}`, followProdDepsOnly: Boolean(config.filterProd.length) })
|
||||||
} else if (filters.length === 0 && workspaceDir && config.workspacePackagePatterns && !config.includeWorkspaceRoot && (cmd === 'run' || cmd === 'exec' || cmd === 'add' || cmd === 'test')) {
|
} else if (filters.length === 0 && workspaceDir && !config.includeWorkspaceRoot && (cmd === 'run' || cmd === 'exec' || cmd === 'add' || cmd === 'test')) {
|
||||||
filters.push({ filter: `!{${relativeWSDirPath()}}`, followProdDepsOnly: Boolean(config.filterProd.length) })
|
filters.push({ filter: `!{${relativeWSDirPath()}}`, followProdDepsOnly: Boolean(config.filterProd.length) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,22 +61,6 @@ test('no projects found', async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test('empty pnpm-workspace.yaml should not break pnpm run -r', async () => {
|
|
||||||
prepare({
|
|
||||||
name: 'project',
|
|
||||||
version: '1.0.0',
|
|
||||||
scripts: {
|
|
||||||
test: 'echo Passed',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
fs.writeFileSync('pnpm-workspace.yaml', '')
|
|
||||||
|
|
||||||
const { stdout, status } = execPnpmSync(['run', '-r', 'test'])
|
|
||||||
expect(status).toBe(0)
|
|
||||||
expect(stdout.toString()).toContain('Passed')
|
|
||||||
})
|
|
||||||
|
|
||||||
const invalidWorkspaceManifests = [
|
const invalidWorkspaceManifests = [
|
||||||
'pnpm-workspaces.yaml',
|
'pnpm-workspaces.yaml',
|
||||||
'pnpm-workspaces.yml',
|
'pnpm-workspaces.yml',
|
||||||
|
|||||||
Reference in New Issue
Block a user