Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Support users using yarn berry but use classic mode #432

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brad-decker
Copy link

If you happen to be using yarn berry as your yarn executable it can cause issues when working with repos that were set up with yarn classic. However, you can set your executable of yarn to classic so that whether you're using yarn 1 or yarn2+ that it'll work the same. This change should have no impact on the library but allow those of us using yarn berry to operate without swiching our executable.

@brad-decker brad-decker requested a review from a team as a code owner March 21, 2023 21:13
@mcmire
Copy link
Contributor

mcmire commented Mar 21, 2023

@brad-decker It's my understanding that Yarn works best if you install v1 (which should be the default version), then activate Berry per project. Can you go into more detail on why you use Berry as the default? If we want to make this change to this project, then that means we ought to make changes to all of our projects that are still using v1... but I am wondering whether there is another way.

@brad-decker
Copy link
Author

Can you say more about why yarn "works best" that way? If I were a new developer figuring out things for the first time I would install node, and most likely either use NPM or if i'm going to use yarn it would be because I visited yarnpkg.com, and then getting started and followed the steps there (which I did even as someone aware of yarn v1 when I set up my new computer). I would not have visited classic.yarnpkg.com/ and I would not have thought to switch to legacy documentation given the header on the main yarnpkg.com site.

I'm not sure that using the "classic" versus "modern" yarn executable is a reasonable universal expectation.

@mcmire
Copy link
Contributor

mcmire commented Mar 21, 2023

Hmm I see. It's possible that I am using an outdated setup and that's influenced my thinking on this. Obviously Yarn Berry is a relatively new addition for us. When I was looking into Berry for the monorepo, my sense was that even after all these years, the fact that it's still not the default (if you just npm install -g yarn you'll get v1) is a conscious and ongoing design decision by the maintainers — that they don't want to surprise people, they want you to enable Berry for each project. I also believe I ended up following the Migration doc instead of the Installation doc. Even if I'd looked at the Installation page, it is likely that I skipped over the Corepack instructions. Corepack is marked as Experimental in the docs, so I wasn't sure whether it was truly something that everyone uses or just the Yarn team.

That said, I guess I need to update my understanding here 😅 If the Yarn docs encourage you to use Berry globally via Corepack, then that's the way it is. I would definitely not expect anyone to go to classic.yarnpkg.com even with an understanding that v1 is/was a thing.

@mcmire
Copy link
Contributor

mcmire commented Mar 21, 2023

@brad-decker This project is set to use Node 12 in development (according to .nvmrc). If you npm install -g corepack it'll tell you that Corepack doesn't support 12. Did you switch to 16 manually or how did that work?

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Can confirm that this works with Yarn Berry (stable) being globally installed.

Copy link
Collaborator

@legobeat legobeat left a comment

Choose a reason for hiding this comment

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

lgtm, though i'd like it better if it can be done without checking in the yarn cjs binary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants