eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.2k stars 868 forks source link

Support of Modern Yarn (Yarn 2+) #1126

Open sbernard31 opened 7 months ago

sbernard31 commented 7 months ago

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:

123Haynes commented 7 months ago

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.

sbernard31 commented 7 months ago

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

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

:thinking:

betalb commented 5 months ago

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.