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.21k stars 867 forks source link

Added Yarn Berry compatibility flag #1012

Closed neo1203 closed 2 years ago

neo1203 commented 2 years ago

Summary

Fixes #928. Added a compatibility flag for Yarn 2.x and above (Berry) so maven-frontend-plugin doesn't consider reported version as invalid anymore and doesn't try to re-install Yarn every time it runs.

Tests and Documentation

Updated CHANGELOG.md and README.md with details about the new flag

neo1203 commented 2 years ago

@eirslett , any feedback on this PR ?

eirslett commented 2 years ago

Can we somehow auto-detect isYarnBerry instead of specifying it in the pom?

neo1203 commented 2 years ago

That's a nice suggestion. We can detect the .yarnrc.yml file in the project folder. In that case, I would still suggest to keep that additional isYarnBerry flag to handle corner cases. Possible values and behavior :

Would that be OK with you ? If it is, I will update the PR with that implementation

eirslett commented 2 years ago

I don't even think we need the force enable/disable. We could add it later on, if anybody really needs it (which I highly doubt). My concern is to keep the number of configuration parameters in the plugin as low as possible.

neo1203 commented 2 years ago

Changes done. I added support for multi-module Maven projects as part of the detection mechanism. In these setups the .yarnrc.yml file will typically be located at the root of the project and not in individual sub-folders, especially if one wants to leverage the Yarn Workspaces feature.

eirslett commented 2 years ago

thanks!

ia3andy commented 9 months ago

@neo1203 @eirslett when using

> yarn set version stable                                                                                                                 main(origin/main)
➤ YN0000: Retrieving https://repo.yarnpkg.com/3.6.3/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-3.6.3.cjs
➤ YN0000: Done in 0s 441ms

It downloads the js locally.

Instead of pre-installing a version of yarn, why not just directly downloading the 2.x+ version from this repo: https://repo.yarnpkg.com/[2.x+]/packages/yarnpkg-cli/bin/yarn.js ?

This would make installation consistant with the other versions configs?