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

Support yarn berry #64

Closed
christophehurpeau opened this issue Apr 13, 2020 · 12 comments
Closed

Support yarn berry #64

christophehurpeau opened this issue Apr 13, 2020 · 12 comments

Comments

@christophehurpeau
Copy link

Hello,

It seems yarn 2 still needs this. I started working on a version that only supports yarn berry: https://github.com/christophehurpeau/yarn-deduplicate/tree/wip-berry

My findings are:

  • use of @yarnpkg/parsers instead of @yarnpkg/lockfile. It also means that the packages are not split automaticly like it was the case in @yarnpkg/lockfile, so merging has to be handled manually
  • there is a new information before the version (I called it source, but not sure if it's the right name). In my lockfiles, it's almost awlays npm, except for different versions of resolve, like resolve@^1.10.0 and other patched versions of resolve, like resolve@patch:resolve@^1.10.0#builtin<compat/resolve>

Do you plan to work on a berry version ?

@Bnaya
Copy link

Bnaya commented Apr 14, 2020

yarn berry is under very active development,
I believe it will be possible to bake that into it

@SimenB
Copy link

SimenB commented Jul 4, 2020

@scinos @rjatkins any thoughts on this? For v2/berry it could be designed as a plugin rather than a separate tool, so we could run yarn deduplicate instead of yarn-deduplicate. I.e. the approach of (the unmaintained?) https://github.com/eps1lon/yarn-plugin-deduplicate

@scinos
Copy link
Owner

scinos commented Jul 9, 2020

It makes a lot of sense to use the new plugin framework.

I'll try to look into writing a plugin (or reviving https://github.com/eps1lon/yarn-plugin-deduplicate) soon, first I need to understand how the plugin system works and get my hands on a few yarn v2 repos with duplicated packages to test everything.

If anyone wants to start working on it meanwhile, it would be great :)

@scinos
Copy link
Owner

scinos commented Jul 9, 2020

There is also this yarnpkg/berry#1558

@SimenB
Copy link

SimenB commented Aug 23, 2020

^ just landed, so I guess this can be closed?

@scinos scinos closed this as completed Aug 26, 2020
@JounQin
Copy link

JounQin commented Jan 9, 2024

yarnplugins/yarn-plugin-deduplicate#13

I hope we can reconsider this.

I'll raise a PR for it like ds300/patch-package#507.

@christophehurpeau
Copy link
Author

@JounQin note that I have working fork here https://github.com/christophehurpeau/yarn-deduplicate / https://www.npmjs.com/package/yarn-berry-deduplicate
I hope to convert it to a yarn plugin some day if this is still not implemented in yarn

@JounQin
Copy link

JounQin commented Jan 9, 2024

@christophehurpeau Thanks for your information, but I'd like to raise a PR for yarn-deduplicate itself to support yarn v1 and v2+ at the same time~

@scinos
Copy link
Owner

scinos commented Jan 9, 2024

Yarn V2+ supports yarn dedupe natively. What's the goal of adding support for V2 to this tool?

@JounQin
Copy link

JounQin commented Jan 9, 2024

Yarn V2+ supports yarn dedupe natively. What's the goal of adding support for V2 to this tool?

It doesn't support --strategy fewer, yet.

See also yarnpkg/berry#2297

@scinos
Copy link
Owner

scinos commented Jan 9, 2024

Looks like nobody is opposed to add the fewer strategy to Yarn.

I haven't looked at the yarn dedupe code in ages, but, from memory, it was really similar to yarn-deduplicate. Meaning that implementing the strategy should be relatively easy.

I may have some time this week to have a look.

@JounQin
Copy link

JounQin commented Jan 9, 2024

I may have some time this week to have a look.

Do you mean you want to work this this week? That would be great! I and my colleague were going to working on this feature also but on yarn-deduplicate's side.

The benefit is, we can use prepare: yarn-duplicate script to run yarn-duplicate every time on installation. But prepare: yarn dedupe will run into a dead loop, at least for now.

(For prepare script support for yarn berry, see also https://github.com/un-es/yarn-plugin-prepare-lifecycle)


Besides, can we reopen this issue first?

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

No branches or pull requests

5 participants