0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

Updates astro add to ignore optional peer dependencies (#5192)

* checking peerDependenciesMeta before including peer deps

* chore: add changeset
This commit is contained in:
Tony Sullivan 2022-10-25 19:57:56 +00:00 committed by GitHub
parent 44fa495761
commit 8728ee0b94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
`astro add` no longer automatically installs optional peer dependencies

View file

@ -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]]);
}
}
}