Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify a complex peer semver used by astro add #3633

Merged
merged 3 commits into from
Jun 22, 2022
Merged

Conversation

FredKSchott
Copy link
Member

@FredKSchott FredKSchott commented Jun 17, 2022

Changes

  • Fixes this odd astro add output
  • Fixes odd behavior when astro add react is run with yarn (reported by @Princesseuh)

Screen Shot 2022-06-17 at 3 31 22 PM

This isn't perfect, but I've never seen a semver string that this wouldn't work for. The next step would be evaluating the semver using a more complex semver-aware parser. I'd rather cross that bridge when we encounter the need.

Testing

  • N/A (code path not currently tested)

Docs

  • N/A (bug fix)

@changeset-bot
Copy link

changeset-bot bot commented Jun 17, 2022

🦋 Changeset detected

Latest commit: b279a6c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jun 17, 2022
@@ -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(' ').pop()}`))
Copy link
Contributor

@tony-sull tony-sull Jun 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this end up always installing react@^18?

It'd be very cool for astro add to prompt me for which version of react I want,

**Which version of react would you like to install?**
◯  ^17.0.2
◯  ^18.0.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! I still think we can get this in and add that as a future enhancement too 👍

Copy link
Contributor

@bholmesdev bholmesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on the split function, but solves the problem!

packages/astro/src/core/add/index.ts Outdated Show resolved Hide resolved
@natemoo-re natemoo-re merged commit 921d9a2 into main Jun 22, 2022
@natemoo-re natemoo-re deleted the fix-peer-add branch June 22, 2022 21:13
@github-actions github-actions bot mentioned this pull request Jun 22, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* fix peer semver used by astro add

* Create pink-shirts-mix.md

* update with regex over `' '` split

Co-authored-by: Ben Holmes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants