frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

Support of Modern Yarn (Yarn 2+)

Open sbernard31 opened this issue 1 year ago • 3 comments

Hi,

I'm currently using this maven plugin with classic-yarn and this works well. :+1:

Sooner or later, I consider to migrate to modern yarn (currently Yarn 4).

But it is not clear to me if this project support it (partially or fully). I see this could work https://github.com/eirslett/frontend-maven-plugin/issues/928 but it seems that some are using workaround (https://github.com/jenkinsci/jenkins/pull/5824#issuecomment-1503593463)

So what is the current status ? and is there any plan about this ?

Thx :pray:

sbernard31 avatar Nov 28 '23 11:11 sbernard31

I think it's at least partially supported. In the readme it states:

If your project is using Yarn Berry (2.x or above), the Yarn version is handled per project but a Yarn 1.x install is still needed as a "bootstrap". The plugin will try to detect .yarnrc.yml file in the current Maven project/module folder, at the root of the multi-module project if relevant, and in the folder from which the mvn command was run. If detected, the plugin will assume your project is using Yarn Berry. It will install the 1.x Yarn version you specify with yarnVersion as bootstrap, then hand over to your project-specific version.

Got added in https://github.com/eirslett/frontend-maven-plugin/pull/1012/files That being said, i haven't tested it myself so i'm not 100% sure.

123Haynes avatar Nov 30 '23 19:11 123Haynes

@123Haynes thx for you answer but I didn't get why Jenkins project seems to say it is missing something for full support :

  • https://github.com/jenkinsci/jenkins/pull/5824#issuecomment-1503593463
  • https://github.com/jenkinsci/jenkins/pull/5824/files#diff-91ff25ed478e4186e5b4a784395ead002f4c14902f2b5ef716390a682e36ccf9R703-R728

(Note that #1012 seems very older than https://github.com/jenkinsci/jenkins/pull/5824)

:thinking:

sbernard31 avatar Dec 01 '23 08:12 sbernard31

Yarn 2, 3, 4 work perfectly fine. You just need to include executable into repository, so simply install classic yarn with maven-frontend-plugin and run yarn commands.

The problem that jenkins team is referencing is support for corepack distribution model, where you don't need to ship yarn berry executable inside of your repo. Yarn 4 switched to corepack by default.

betalb avatar Jan 16 '24 10:01 betalb