diff --git a/.changeset/pink-shirts-mix.md b/.changeset/pink-shirts-mix.md new file mode 100644 index 0000000000..a1d14454aa --- /dev/null +++ b/.changeset/pink-shirts-mix.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fix a bug with `astro add react` adding a too-complex semver to your package.json diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 09664f8f1b..f022599120 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -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) {