Updates astro add
to ignore optional peer dependencies (#5192)
* checking peerDependenciesMeta before including peer deps * chore: add changeset
This commit is contained in:
parent
44fa495761
commit
8728ee0b94
2 changed files with 10 additions and 1 deletions
5
.changeset/smart-chicken-develop.md
Normal file
5
.changeset/smart-chicken-develop.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
`astro add` no longer automatically installs optional peer dependencies
|
|
@ -705,8 +705,12 @@ export async function validateIntegrations(integrations: string[]): Promise<Inte
|
|||
];
|
||||
|
||||
if (pkgJson['peerDependencies']) {
|
||||
const meta = pkgJson['peerDependenciesMeta'] || {}
|
||||
for (const peer in pkgJson['peerDependencies']) {
|
||||
dependencies.push([peer, pkgJson['peerDependencies'][peer]]);
|
||||
const optional = meta[peer]?.optional || false
|
||||
if (!optional) {
|
||||
dependencies.push([peer, pkgJson['peerDependencies'][peer]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue