NPX?
I might be missing something obvious, but how I can create a gradle task that runs npx
Hi there!
It does not seem like this project is still active at the moment.
For a workaround you might use something like this:
task npxWorkaround(type: Exec) {
dependsOn "npmInstall"
if (System.getProperty("os.name").toUpperCase().contains("WINDOWS")) {
commandLine "${dirWhereIInstalledNodeModules}/node_modules/.bin/my_module_executable.cmd"
} else {
commandLine "${dirWhereIInstalledNodeModules}/node_modules/.bin/my_module_executable"
}
}
If you do not have node installed locally and install it via the plugin you might need to actually call it directly via a NodeTask.
task doSth(type: NodeTask) {
dependsOn "npmInstall"
script = file("${dirWhereIInstalledNodeModules}/node_modules/my_module/bin/my_module_executable")
}
Ah, this seems like a good solution! Let me give this a go, thank you so much for taking the time to give me a hand here.
There's support for NpxTask in the fork thanks to this PR https://github.com/node-gradle/gradle-node-plugin/pull/32