pinboard icon indicating copy to clipboard operation
pinboard copied to clipboard

Update yarn to latest stable version

Open mchv opened this issue 1 year ago • 2 comments

What does this change?

This update yarn from 1.22.17 to the latest stable version 4.2.2.

There are a few noteworthy changes:

Adding the range for react-dom and react dependencies

The parsing of version dependency since yarn 2.x is more strict, which means the react and react-dom alias package needs an additional range to work (preact issue about it)

Removal of yarn-duplicate

The yarn-duplicate package is not necessary anymore, and has been replaced by the native dedupe command:

  • commit f7abd45833682923b15e00c3b1bba4314b7a9b91
  • commit b8b0617254f16e1e60c41d2195fe9435ce3f6c06
  • commit 71195d9fe9872bdf12d8b5334b28f9dfc808ef57

Warnings displayed when installing

When executing yarn install a few warnings are now displayed

Screenshot 2024-05-15 at 21 13 22

The associated changes do not address them, but with the associated changes it should be easier to update packages to address them (for instance updating jest and ts-jest seems sensible and not too difficult)

Retrieval of the right version of yarn

In order to retrieve the right version of yarn, it is now recommended to use corepack, rather than
This is very similar to that change in dotcom-rendering:

  • commit c63df94a2358e955668d57a0574095f233a9474f

Upgrade of node version

However for the right yarn version to be picked up, un upgrade to the latest 18.xx node version was needed (see https://github.com/pnpm/pnpm/issues/7724), otherwise yarn version is not found:

And yarn install fail miserably:

Type Error: URL.canParse is not a function
    at parseSpec (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23627:21)
    at loadSpec (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23704:11)
    at async findProjectSpec (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23649:20)
    at async executePackageManagerRequest (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:24223:18)
    at async BinaryCommand.validateAndExecute (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21173:22)
    at async _Cli.run (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22148:18)
    at async Object.runMain (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:24279:[12](https://github.com/guardian/pinboard/actions/runs/9100236939/job/25014586984#step:7:13))
Error: Process completed with exit code 1.
  • commit d8a454fbf40c3f2e3676ea848e3d5d25226e5ac7

mchv avatar May 15 '24 20:05 mchv

amazing, thank you @mchv - appreciate the detailed sequential PR description - the diff LGTM, I'm checking it out locally now to make sure various scripts involved in running locally all continue to work and will deploy to CODE - expect approval incoming shortly

twrichards avatar May 16 '24 14:05 twrichards

amazing, thank you @mchv - appreciate the detailed sequential PR description - the diff LGTM, I'm checking it out locally now to make sure various scripts involved in running locally all continue to work and will deploy to CODE - expect approval incoming shortly

looking good so far, but will do some more testing tomorrow - @mchv please feel free to enable auto merge and i'll approve tomorrow morning when all checked - thanks

twrichards avatar May 16 '24 14:05 twrichards

Seen on PROD (merged by @mchv 3 minutes and 15 seconds ago) Please check your changes!

prout-bot avatar May 28 '24 08:05 prout-bot