Skip to content

Conversation

@tjzel
Copy link
Collaborator

@tjzel tjzel commented Apr 3, 2024

Summary

Migrating from yarn1, which is no longer supported, to yarn4. It comes with many features, first and foremost - support, followed by yarn.lock poisoning protection, better organization of package lifecycle and so on.

Key changes in this PR:

Removal of yarn prepare

Custom pre and post scripts are no longer supported. Therefore, steps from yarn prepare have to be moved to yarn build which then has to be called explicitly. This is why in many CIs I had to add this explicit step. Also, postinstall script should never be used if possible.

You can read more about it here.

Hardened mode

You can notice that all the CIs now have

env:
  YARN_ENABLE_HARDENED_MODE: 0

with an exception of a new CI validate-yarn.yml, which has

env:
  YARN_ENABLE_HARDENED_MODE: 1

This is because yarn3+ comes with yarn.lock poisoning protection out of the box, and it is enabled when yarn detects a pull request to the repo. This significantly slows down CIs, and as per yarn documentation recommendations, we turn it off for each CI except for one dedicated one.

.yarn/releases

New yarn comes with idea that not only the dependencies should be locked, but also the package manager itself. That's why it's a standard now to commit the whole yarn source file in the repo, so each user uses exactly the same version. I know it seems weird at first, but you'll get over it same as I did.


Also minor changes due to fact that packages got bumped and some TS types weren't working etc.

Test plan

:shipit:

The only CIs that don't pass are the ones that don't work on main either.

@tjzel tjzel changed the title Migrate to yarn4 Migrate to yarn3 Apr 4, 2024
@tjzel tjzel marked this pull request as ready for review April 10, 2024 09:43
Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

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

I have no more comments than Tomek 👍

Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

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

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants