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

Yarn 2 support #1180

Closed
arcanis opened this issue Jan 2, 2020 · 26 comments
Closed

Yarn 2 support #1180

arcanis opened this issue Jan 2, 2020 · 26 comments
Labels

Comments

@arcanis
Copy link

arcanis commented Jan 2, 2020

Hello! We plan to release Yarn 2 by the end of the month, so I want to open this thread to discuss how you'd see the upgrade path for the users of the Node image.

The 2.x releases will contain some breaking changes, so while our users will always be able to use the 1.x thanks to the yarnPath strategy, maybe you'll want to hold on until the next major (do Docker images have majors?). Or maybe a simpler strategy would be to just add "How to use Yarn 1 if I need to?" in the README?

@SimenB
Copy link
Member

SimenB commented Jan 2, 2020

We currently see node majors as possibilities to make breaking changes to the images. Not sure what to do here, probably document how to install the version of yarn you want and bump for node 14 when it comes in april.

Is there a list of breaking changes?

@SimenB
Copy link
Member

SimenB commented Jan 2, 2020

/cc @nodejs/docker

@arcanis
Copy link
Author

arcanis commented Jan 2, 2020

The current changelog is slightly outdated as I'm working on it, but is here: https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md

Overall the breaking changes are:

  • The npm configuration isn't read anymore (everything in .yarnrc.yml)
  • The bundleDependencies field is deprecated
  • The package sources are kept in read-only stores by default
  • Package boundaries must be respected
  • Node scripts must be executed through yarn node ... instead of node ...

@SimenB
Copy link
Member

SimenB commented Jan 24, 2020

Now that v2 is out what are our thoughts on this @nodejs/docker?

Personally I think going v2 by default from Node 14 (next major) makes sense. Maybe some doc updates for current versions? V12 is here until April 2022, so I think we need a plan or at least some docs

@nschonni
Copy link
Member

I commented over on the other Yarn thread #777 (comment) that I think it might be better that Yarn has a separate Official Image.
They could probably take a bunch of what is in this repo, but only support a subset of the images

@SimenB
Copy link
Member

SimenB commented Jan 27, 2020

Answered over there, off topic in this issue (although this issue would be redundant if we remove yarn, no-one is suggesting changing anything (beyond docs, maybe) at least until 14 is released in late April)

@eloytoro
Copy link

I'd like to add that by the looks of it there's a big chance that upgrading yarn to v2 in the node 14 image will introduce several breaking changes for projects that would result in the project not being able to execute because of changes unrelated to node itself

@arcanis
Copy link
Author

arcanis commented Jan 27, 2020

Yes, I think it's perfectly fine if docker-node remains on 1.x after all.

Fwiw we're pivoting to a "trampoline model" where we only need a Yarn to be in the $PATH - just enough to bootstrap the per-project Yarn version by looking at the yarnPath setting (similar to gulp vs gulp-cli in the past, if you remember).

@Starefossen
Copy link
Member

I agree! We should provide the yarn2 binary, but not replace yarn until the next major version of docker-node

@SimenB
Copy link
Member

SimenB commented Jan 27, 2020

@arcanis do you think we should just ship that small script instead of the full yarn binary along with setting a default yarn policy? Would that mean people need a network connection to run yarn at all? Or just keep yarn v1 as-is and document how to use version policy for v2 (and future majors)?

@arcanis
Copy link
Author

arcanis commented Jan 27, 2020

Would that mean people need a network connection to run yarn at all?

No; the binary will be checked into the repositories, so running any yarn command inside the project folder will use that without installing things from the network (it's handy; containers don't have to be rebuilt when upgrading Yarn).

do you think we should just ship that small script instead of the full yarn binary? Or just keep yarn v1 as-is and document how to use version policy for v2 (and future majors)?

I think for now keeping Yarn 1.x as-is and document the version policy is the most efficient way to move forward. Shipping just a small script is probably a bit too drastic at the moment, and assuming we will only get one shot to do this right I'd like to consider a few options first.

@SimenB
Copy link
Member

SimenB commented Jan 27, 2020

That sounds good @arcanis, thanks!

@omeid

This comment has been minimized.

@nschonni

This comment has been minimized.

@SimenB
Copy link
Member

SimenB commented Jan 29, 2020

We document yarn policies set-version already: https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#upgradingdowngrading-yarn

I've got a feeling people won't see that unless we link from README.md, though. Thoughts on just sticking a link to the section in the main readme, and calling this solved? If those instructions are correct, that is 🙂

@daveisfera

This comment has been minimized.

@SimenB

This comment has been minimized.

@daveisfera

This comment has been minimized.

@SimenB
Copy link
Member

SimenB commented Jan 29, 2020

Another thing @arcanis - we do curl -sSL --compressed https://yarnpkg.com/latest-version to know which version to update to on new node versions. Will that keep pointing to yarn 1 or should we use some other endpoint?

yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"

@arcanis
Copy link
Author

arcanis commented Jan 29, 2020

Yep, it'll safely stay on 1.x 👍

@omeid
Copy link

omeid commented Jan 29, 2020

My concerns with Yarn remains with Yarn, however, I would like the official docker images to stay sane too.

If you're going to change Yarn to Yarn2, you better have bloody good rationales, because despite the name Yarn and Yarn2 are not the same products, they barely even have the same goals.

So this is not a conversation of should Yarn be upgraded in Node 14 but rather should Yarn be replaced by something else, Yarn2.

@SimenB
Copy link
Member

SimenB commented Jan 30, 2020

Did you read the whole issue? We'll be keeping yarn 1 and just make sure the docs are clear on how to use yarn 2 if people want

@nschonni
Copy link
Member

@SimenB it might be good to rename the issue to something like "Yarn 2 Support", since I think the current wording might be causing people to thing this is an announcement for this repo's intention

@SimenB
Copy link
Member

SimenB commented Jan 30, 2020

Yeah, good call. I'll do that

@Lonli-Lokli
Copy link

So as I understand yarn2 still not available in the node14. Will it be available in the Node15?

@DRoet
Copy link

DRoet commented Jul 13, 2020

@Lonli-Lokli as of right now it is recommended to use the yarn 1.x installment and setup yarn 2 on a per-project basis, so somewhere in your dockerfile you should just do yarn set version berry

as described here: https://yarnpkg.com/getting-started/install

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

No branches or pull requests

10 participants