node-gradle / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
601 stars 117 forks source link

Increase default node and npm versions #226

Closed pelletier197 closed 2 years ago

pelletier197 commented 2 years ago

The current default node and npm versions are quite outdated. In fact, the current default node version (14.15.4) does not even have a build for arm64 (the new macs), so we are forced to override the version in every project we have. Source: this file

Also, node 16 is the current LTS version according to this, until september 2022.

My proposition is simply to bump default node, npm (and potentially yarn and pnpm as well) to version

Is there any opposition to doing that?

deepy commented 2 years ago

Bumping to latest node LTS and changing npms default to match the one bundled with node (or an LTS) sounds great to me

I think there's some tests relying on the npm version though

pelletier197 commented 2 years ago

Okay. I can try to do that when I get some time. I just wanted to get the approval of someone before I do it :smile: Thank you

deepy commented 2 years ago

What makes npm tricky is that in the src/test/resources/fixtures there's some package.json and package-lock.jsons that also need to get upgraded.

And then there's some references in tests like NpmRule_integTest where you see things like: def versionPattern = Pattern.compile(".*Version\\s+6.12.0.*", Pattern.DOTALL)

And finally there's also the tests that do things like: result4.output.contains("> Task :version${System.lineSeparator()}6.12.0")

pelletier197 commented 2 years ago

Seems good. I'll try to figure out a way. If I really can't get around npm, I'll check if updating node alone is doable, at least to have it work under arm64.

Thank you!

deepy commented 2 years ago

yarn is tricky to upgrade since yarn2 works very differently (and I don't know of a good way to support it with the current state, with the toolchain-esque setup it should be fairly simple however) pnpm is not merged yet so that one is simple to upgrade

But next version is getting Node 16.14.2 and npm 8.5.0 as defaults

pelletier197 commented 2 years ago

I see you did it. Sorry, I didn't take the time to do it. Been pretty busy with a project of mine. But thank you very much!

For yarn, you shouldn't update to yarn2 imo. They brought some annoying breaking changes. Most projects I see still use yarn 1. 😅

pelletier197 commented 2 years ago

Yarn 2 was actually not that well received by the community. It's basically a completely different package manager than V1 and is incompatible with many projects.

https://njbmartin.medium.com/whats-the-problem-with-yarn-2-ca59e3fabc9f

deepy commented 2 years ago

I've no plans to upgrade to yarn2, I find their distribution model bonkers :-)

But I'd like to add support for it in the future though that's tracked in https://github.com/node-gradle/gradle-node-plugin/issues/176

pelletier197 commented 2 years ago

That's good to have both then, for sure!