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?
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?
/cc @nodejs/docker
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:
.yarnrc.yml)yarn node ... instead of node ...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
I commented over on the other Yarn thread https://github.com/nodejs/docker-node/issues/777#issuecomment-576436253 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
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)
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
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).
I agree! We should provide the yarn2 binary, but not replace yarn until the next major version of docker-node
@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)?
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.
That sounds good @arcanis, thanks!
I think this is perhaps a little off topic, but can someone please explain the rationale for the plethora of changes and features in a big drop without much beta/field testing?
If Yarn2 (which in all honestly should have been called something else) is going to replace Yarn in Node 14, I would expect a solid _why_ rather than _what_ we should change.
I think any decision regarding changing yarn without cost-benefits and rationale for change is far from prudent.
@omeid it's probably better to open an issue over on https://github.com/yarnpkg/berry for concerns with Yarn2 in general
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 馃檪
Is there a recommended way to test this in a docker image to see what the transition will look like?
Just follow the instructions I linked in the post before yours.
docker run node:buster-slim bash -c 'yarn policies set-version berry; yarn --version'
馃う鈥嶁檪
Thanks
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?
https://github.com/nodejs/docker-node/blob/b927622b91df092f6a9c8491acb1be50eb73f4cc/update.sh#L75
Yep, it'll safely stay on 1.x 馃憤
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.
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
@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
Yeah, good call. I'll do that
So as I understand yarn2 still not available in the node14. Will it be available in the Node15?
@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
Most helpful comment
I commented over on the other Yarn thread https://github.com/nodejs/docker-node/issues/777#issuecomment-576436253 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