6.0.0
Yarn Berry initial support (Yarn 1, Yarn 2+)
Introduction
Yarn 2+ (Berry codename) is a massive rewrite of the package manager. Contrary to former Classic Yarn 1.x for which distribution archives are published, Yarn 2+ cannot be installed with a distribution archive anymore. Download and installation are entirely handled by Yarn itself, thanks to a preliminary global install with NPM.
This release brings an initial support of new Yarn package manager (often referred to as Yarn Berry, Yarn 2, or Yarn PnP), which provides access to Yarn releases 1.x and above in a different way than previous release of the package manager. This initial support means that we focused mainly on migration of projects based on Classic Yarn, to ensure they can go on using the plugin and a Yarn 1.x distribution through Yarn Berry "mode". There may be many use cases specific to Yarn 2 that the plugin is not aware of.
Impacts
The plugin components formerly in charge of downloading Classic Yarn 1.x distributions had to be refactored to handle Yarn installation in a different way, the way enforced by Yarn Berry:
- The plugin does not download and explode a Yarn distribution anymore.
- Using a proxy to download Yarn distributions must be configured at Yarn's level.
- Basic authentication settings for Yarn become irrelevant.
- Installing Yarn now requires the Node.js distribution to be present (i.e. the
installNode
task becomes an indirect dependency of theinstallYarn
task). Indirect because before the appropriate Yarn distribution is installed in the (sub-)project, the plugin executes new tasksinstallGlobalYarn
andenableYarnBerry
. These 2 "technical" tasks allow to prepare the per-project installation, as explained in Yarn's install guide. The dependency chain now becomesinstallNode
<-installGlobalYarn
<-enableYarnBerry
<-installYarn
, and is executed left to right. TheinstallYarn
task still means the same thing: get a ready-to-use Yarn distribution for the project.
Features
- Added support of Yarn 2 (#139)
Tasks
- Task type
RunNpmYarn
was split in 2 distinct typesRunNpm
andRunYarn
.
Upgrading from 5.0.0+
A definitive migration guide is very difficult to achieve, as there are many different configurations to take into account. Feel free to report any issue/improvement in the suggested steps below:
- Ensure you are able to rollback to a previous version of your project in case of problem (VCS, backup, etc).
NODEJS_HOME
environment variable is not used anymore by the plugin to resolve the location of thenode
executable. Now the plugin relies on theFGP_NODEJS_HOME
environment variable. Update your environment variables accordingly if your build was explicitly relying on this variable (see documentation of thenodeDistributionProvided
property).- The project relies on NPM (i.e.
yarnEnabled
property isfalse
):- Update any custom task using the former
RunNpmYarn
type withRunNpm
type.
- Update any custom task using the former
- The project relies on Yarn (i.e.
yarnEnabled
property istrue
):- If the
yarnDistributionProvided
property isfalse
, the plugin will not use a previously downloaded distribution (i.e. the one pointed by theyarnInstallDirectory
property). You may remove it. - Any
YARN_HOME
environment variable may have to be renamed, becauseYARN_*
environment variables are now used automatically by Yarn to resolve some of its settings (see this section). Note that theYARN_HOME
environment variable is not used anymore by the plugin to resolve a Yarn distribution on the system. - Remove properties
yarnDistributionProvided
,yarnDistributionUrlRoot
,yarnDistributionUrlPathPattern
,yarnDistributionServerUsername
,yarnDistributionServerPassword
,yarnInstallDirectory
. - Update any custom task using the former
RunNpmYarn
type withRunYarn
type. - Proxy settings don't apply to Yarn anymore. Refer to Yarn's documentation of
httpsProxy
property orhttpProxy
property) as a replacement. - If the
nodeDistributionProvided
property isfalse
, and the Node.js distribution is not shared with other projects outside the root project, upgrade shall be completed. - Otherwise, ensure installing a Classic Yarn 1.x distribution globally (i.e. in the Node.js distribution) does not break other projects (the
yarn
executable located now in the Node.js distribution might take precedence over another executable).
- If the
We don't recommend upgrading simultaneously the plugin and Yarn (i.e. updating yarnVersion
property to 2.x), to ease troubleshooting in case of problems. If you do so, keep in mind the plugin won't perform the migration of your project files (for this particular point, you should follow Yarn's migration guide). Instead:
- First upgrade the plugin, and migrate project by following Yarn's migration guide. Ensure everything is working fine without changing the
yarnVersion
property (i.e. keep a Yarn 1.x distribution). At this point, keep in mind Yarn Berry deals with these distributions, and will take over from the plugin to download and install the relevant distribution. - Then update Yarn's version.