Skip to content

Upgrade to yarn 3 #7903

@Fryguy

Description

@Fryguy

Right now we are using yarn 1.22, however newer versions of yarn have been out for a while, with yarn 3.0.2 being the latest. yarn 3 changes things, but not as dramatically as one might think. We can use the nodeLinker: node_modules mode to move forward but keep backward compatibility until we can move towards Plug'n'Play.

See also https://yarnpkg.com/getting-started/migration. The goal is to get to Plug'n'Play mode, but the first step is to upgrade yarn. After that we have to fix the dependency warnings and any direct calls to node_modules.

Some things to note in these changes.

  • yarn now uses a project-committed version of yarn as opposed to a global version (the global is only used to kick off the project-committed version). There are pros and cons, IMO, but you will see a yarn-3.0.2 file installed in each repo. Upgrades are pretty easy though, by just running yarn set version latest then committing the changes, so we can create a blaster-outer script for that.

  • I've opted for the global cache as opposed to a project specific cache. Due to the way we use git repositories, the gem repo is effectively recreated on new pulls, so this should help with avoiding re-downloading all of the node modules.

  • Installation time is surprisingly not that much faster with the cache, because of the need to still create the node_modules directories. Once we move to Plug'n'Play, however, that should minimize greatly.

    time note
    1:36.71 before - uncached
    2:48.28 after - uncached (similar to a fresh bin/setup)
    1:19.93 after - fetch cached, but not node_modules (similar to bin/update that pulls in a new gem)
    18.68 after - fetch and node_modules cached (similar to local dev)
  • The new format is so much nicer on your eyes 😉


Must be merged / tested together:

Should be merged with the others

Technically optional, but would be good to get all of our dependencies to the same level

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions