simplify a complex peer semver used by astro add (#3633)

* fix peer semver used by astro add

* Create pink-shirts-mix.md

* update with regex over `' '` split

Co-authored-by: Ben Holmes <hey@bholmes.dev>
This commit is contained in:
Fred K. Schott 2022-06-22 14:13:32 -07:00 committed by GitHub
parent b9f891b8a6
commit 921d9a27e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fix a bug with `astro add react` adding a too-complex semver to your package.json

View file

@ -407,7 +407,7 @@ async function getInstallIntegrationsCommand({
.map<[string, string | null][]>((i) => [[i.packageName, null], ...i.dependencies])
.flat(1)
.filter((dep, i, arr) => arr.findIndex((d) => d[0] === dep[0]) === i)
.map(([name, version]) => (version === null ? name : `${name}@${version}`))
.map(([name, version]) => (version === null ? name : `${name}@${version.split(/\s*\|\|\s*/).pop()}`))
.sort();
switch (pm.name) {