-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Conversation
🦋 Changeset detectedLatest commit: b279a6c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
packages/astro/src/core/add/index.ts
Outdated
@@ -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()}`)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍
There was a problem hiding this 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!
* fix peer semver used by astro add * Create pink-shirts-mix.md * update with regex over `' '` split Co-authored-by: Ben Holmes <[email protected]>
Changes
astro add
outputastro add react
is run with yarn (reported by @Princesseuh)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
Docs