Filter out astro from peerDependencies in astro add (#7620)

This commit is contained in:
Chris Swithinbank 2023-07-11 12:42:11 +02:00 committed by GitHub
parent 13b36d962a
commit 831dfd1516
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Filter out `astro` from integration peer dependencies when running `astro add`

View file

@ -756,7 +756,8 @@ export async function validateIntegrations(integrations: string[]): Promise<Inte
const meta = pkgJson['peerDependenciesMeta'] || {}; const meta = pkgJson['peerDependenciesMeta'] || {};
for (const peer in pkgJson['peerDependencies']) { for (const peer in pkgJson['peerDependencies']) {
const optional = meta[peer]?.optional || false; const optional = meta[peer]?.optional || false;
if (!optional) { const isAstro = peer === 'astro';
if (!optional && !isAstro) {
dependencies.push([peer, pkgJson['peerDependencies'][peer]]); dependencies.push([peer, pkgJson['peerDependencies'][peer]]);
} }
} }