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 867 forks source link

Version designation not standard. #1075

Closed garretwilson closed 1 year ago

garretwilson commented 1 year ago

This is a small issue, but if I indicate the Node version like this:

<nodeVersion>18.15.0</nodeVersion>

I get a warning:

[WARNING] Node version does not start with naming convention 'v'.

It is true that if there is no context, prefixing something with a v is the convention for indicating that it is a version. For example tagging a Git repository commit with v1.2.3 is preferable to 1.2.3, because you don't necessarily know what 1.2.3 means.

But here the name of the element is <nodeVersion>, and the name of the setting is nodeVersion. There is no ambiguity about what 1.2.3 means, and indicating v1.2.3 as the value is redundant, as the setting name already indicates "version". Furthermore this is not the standard practice for maven dependency version indication; normally one does not indicate vā€¦ in the value.

Again this is a little thing, but it's a thing nevertheless. šŸ˜„

garretwilson commented 1 year ago

I just want to come back and say thought that this plugin is amazing. Thank you so much for creating it!! Please consider this ticket as an attempt to make something really good even better. The most important thing is that the plugin works, and it works like a charm.

eirslett commented 1 year ago

Yeah, I agree it's a bit weird. It's for historical reasons. This plugin was initially released back in the day when Node v0.10.x (I think) was the latest and greatest. Back then, they had the habit of prefixing all Node versions with v. It was even stranger that npm doesn't follow the same naming convention with the v prefix. You can see the v prefix thing going on in their CDN: https://nodejs.org/dist/ The same v prefix is not in the npm CDN https://registry.npmjs.org/npm/-/

The way this plugin works, is that it builds the download URL dynamically based on <nodeVersion>. Therefore, it was a deliberate choice to explicitly use the v prefix in the pom.xml file. The reason is that if this plugin were to always add the v for you in the URL, that could cause problems in the future, if Node.js ever decided to remove their v from their version names. Looks like they never did, though, at least not yet! Again, this decision was made many years ago when Node was at 0.10.something. Most people were using JAWR for bundling. Grunt was bleeding edge, TypeScript was still 0.x.something. Well, anyways, here we are! That's the story of the v.