Skip to content

Commit

Permalink
Updates astro add to ignore optional peer dependencies (#5192)
Browse files Browse the repository at this point in the history
* checking peerDependenciesMeta before including peer deps

* chore: add changeset
  • Loading branch information
Tony Sullivan committed Oct 25, 2022
1 parent 44fa495 commit 8728ee0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smart-chicken-develop.md
@@ -0,0 +1,5 @@
---
'astro': patch
---

`astro add` no longer automatically installs optional peer dependencies
6 changes: 5 additions & 1 deletion packages/astro/src/core/add/index.ts
Expand Up @@ -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]]);
}
}
}

Expand Down

0 comments on commit 8728ee0

Please sign in to comment.