HubSpot / prettier-maven-plugin

Apache License 2.0
116 stars 23 forks source link

support "local" node #28

Closed Mortinke closed 2 years ago

Mortinke commented 3 years ago

Hi,

firstly, thanks for this plugin! We would like to use this plugin in our CI pipeline in which we use Alpine Container Images. Unfortunately the currently available Node 8 & 10 binaries doesn't work in Alpine. To use the plugin in Alpine, we have to replace the plugin node binaries with the Alpine node binaries (installed with apk add nodejs).

[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.10:check (default-cli) on project *******: Error trying to run prettier-java: Cannot run program "/home/maven/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.10/prettier-maven-plugin-0.10-node-12.13.0-linux.exe" (in directory "/"): error=2, No such file or directory -> [Help 1]

Instead of adding the Alpine binaries to the project, we thought about supporting a local node. What do you think about to introduce new cli option like prettier.nodePath where?

mihaeu commented 3 years ago

Would an option nodePath be better or maybe something more generic like useLocalNode? The latter would have the advantage that the OS chooses which node to use.

jhaber commented 3 years ago

I think nodePath could cover both cases, because if you want to use whichever version of node is on your path then you could just pass nodePath=node

morganwu277 commented 2 years ago

For any person using alpine container linux can use my patch to build prettier maven plugin and then use customized nodePath as you wish