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

feat(essentials): add preferReuse setting #4221

Merged
merged 17 commits into from
Apr 8, 2022

Conversation

marionebl
Copy link
Contributor

@marionebl marionebl commented Mar 15, 2022

What's the problem this PR addresses?

I want to keep dependencies across all workspaces in sync as much as possible; working with a larger number of collaborators often means preferInteractive is not enough to reuse existing versions. --cached fits the bill but there is no option to enable it by default.

E.g. for a scenario where react@16 is present somewhere in the project I want to install react@16 over react@17 given the command

yarn add react

...

How did you fix it?

  • Added a preferReuse options

...

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@merceyz merceyz marked this pull request as draft March 15, 2022 11:48
@marionebl marionebl changed the title WIP feat: expose preferReuse and preferCached WIP feat: expose preferReuse Mar 29, 2022
@marionebl marionebl marked this pull request as ready for review March 29, 2022 11:57
@marionebl marionebl requested a review from arcanis as a code owner March 29, 2022 11:57
@marionebl marionebl changed the title WIP feat: expose preferReuse feat: expose preferReuse Mar 29, 2022
@merceyz merceyz changed the title feat: expose preferReuse feat(essentials): add preferReuse setting Mar 30, 2022
Copy link
Member

@merceyz merceyz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I really appreciate that you included a test and updated the JSON schema.
I have a few comments but otherwise this looks good.

packages/yarnpkg-core/sources/Configuration.ts Outdated Show resolved Hide resolved
packages/gatsby/static/configuration/yarnrc.json Outdated Show resolved Hide resolved
packages/plugin-essentials/sources/commands/add.ts Outdated Show resolved Hide resolved
packages/plugin-essentials/sources/commands/add.ts Outdated Show resolved Hide resolved
marionebl and others added 6 commits March 31, 2022 18:25
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
@marionebl marionebl requested a review from merceyz March 31, 2022 09:09
Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
@marionebl marionebl requested a review from merceyz March 31, 2022 09:27
Copy link
Member

@merceyz merceyz left a comment

Choose a reason for hiding this comment

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

LGTM, I'll hold off on merging until @arcanis has had a chance to look at it as well since you two discussed this on Discord.

@arcanis arcanis merged commit 5681a5f into yarnpkg:master Apr 8, 2022
@arcanis
Copy link
Member

arcanis commented Apr 8, 2022

LGTM! Thanks @marionebl!

@marionebl marionebl deleted the expose-prefer-strategy branch April 9, 2022 05:15
merceyz pushed a commit that referenced this pull request Oct 22, 2023
* feat: expose preferReuse and preferCached

* chore: add release data

* remove preferCached

* remove preferCached from config

* set all release strategies

* add default

* add test

* remove unused

* docs: improve explanation

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* style: inline type predicate

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* refactor: remove unused

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* fix: move preferReuse config

* refactor: use makeTemporaryEnv config creator

* fix: remove unused

* docs: improve explanation

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* fix: escape `

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
(cherry picked from commit 5681a5f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants