Is there a way to get from `build.gradle.kts` full...
# javascript
r
Is there a way to get from
build.gradle.kts
full path to the binary of NodeJs installed by the gradle plugin (it's
~/.gradle/nodejs/node-v12.14.0-linux-x64/bin/node
for me)?
I've checked the sources but the
environment
val is
internal
in
NodeJsRootExtension
:(
Here's what I came up with:
Copy code
fun getNodeJsBinaryExecutable(): String {
    val nodeDir = NodeJsRootPlugin.apply(project).nodeJsSetupTask.destination
    val isWindows = System.getProperty("os.name").toLowerCase().contains("windows")
    val nodeBinDir = if (isWindows) nodeDir else nodeDir.resolve("bin")
    val command = NodeJsRootPlugin.apply(project).nodeCommand
    val finalCommand = if (isWindows && command == "node") "node.exe" else command
    return nodeBinDir.resolve(finalCommand).absolutePath
}