mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 11:01:30 -04:00
fix(validatePeerDependencies): allow combinations (#8946)
This commit is contained in:
6
.changeset/fair-ducks-mix.md
Normal file
6
.changeset/fair-ducks-mix.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@pnpm/resolve-dependencies": patch
|
||||||
|
"pnpm": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Allow `workspace:` and `catalog:` to be part of wider version range in `peerDependencies`.
|
||||||
@@ -25,5 +25,6 @@ export function validatePeerDependencies (project: ProjectToValidate): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isValidPeerVersion (version: string): boolean {
|
function isValidPeerVersion (version: string): boolean {
|
||||||
return typeof validRange(version) === 'string' || version.startsWith('workspace:') || version.startsWith('catalog:')
|
// we use `includes` instead of `startsWith` because `workspace:*` and `catalog:*` could be a part of a wider version range expression
|
||||||
|
return typeof validRange(version) === 'string' || version.includes('workspace:') || version.includes('catalog:')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ test('accepts valid specifications that make sense for peerDependencies', () =>
|
|||||||
'semver-range': '>=1.2.3 || ^3.2.1',
|
'semver-range': '>=1.2.3 || ^3.2.1',
|
||||||
'workspace-scheme': 'workspace:^',
|
'workspace-scheme': 'workspace:^',
|
||||||
'catalog-scheme': 'catalog:',
|
'catalog-scheme': 'catalog:',
|
||||||
|
'combine-all': '>=1.2.3 || ^3.2.1 || workspace:^ || catalog:',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user