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

[Feature] Add option to automatically apply dedupe strategy on add/remove cli command #2770

Closed
2 tasks done
noahnu opened this issue Apr 16, 2021 · 1 comment
Closed
2 tasks done
Labels
enhancement New feature or request

Comments

@noahnu
Copy link
Contributor

noahnu commented Apr 16, 2021

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

As a developer, I always run yarn dedupe after adding, removing, or updating packages. I perform a yarn dedupe --check in CI to prevent unnecessarily duplicated packages from ending up in my production environment. This creates unnecessary complexity.

Describe the solution you'd like

Introduce a new config property to .yarnrc.yml that lets you specify the dedupe strategy used in the yarn add command.

Describe the drawbacks of your solution

If we default the stategy to "none" / "off", I don't see any drawbacks. Perhaps main drawback would be coupling dedupe with add, which are currently quite isolated in the codebase.

Describe alternatives you've considered

postinstall script to run dedupe: only want to run it in development and don't want to unnecessarily run it if packages haven't changed.

Custom plugin: it's an option and would be quite easy to implement, but this seems like it'd be valuable in the yarn core.

@noahnu noahnu added the enhancement New feature or request label Apr 16, 2021
@arcanis
Copy link
Member

arcanis commented Apr 16, 2021

I believe the additional coupling is something that would be best avoided. Additionally, it can be implemented via a contrib plugin (since we have hooks executing when adding something via yarn add), so it doesn't seem like something that should start as a core offering (I tend to be fairly conservative: core offering must be actively used by the active core team, otherwise we won't dogfood it and regressions are more likely).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants