I'd like to be able to run a script in node_module...
# gradle
a
I'd like to be able to run a script in node_modules/.bin using Gradle and kotlin("multiplatform") version 1.5.31. I can see that the npm dependency is downloaded and the script exists in
<rootDir>/build/js/packages/data-model/node_modules/.bin/tstl
, but can I create a Gradle task that executes
npx tstl
or similar in a nice way? I feel like I'm close. I see in
NpmProject
there's
fun useTool(...)
- but I can't figure out how to access the
NpmProject
from within a build.gradle.kts. https://github.com/JetBrains/kotlin/blob/0915dac1f9f0e435e85d6b0cf3d255da1fd9ece1/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/NpmProject.kt#L86 I also see there's a
NodeJsExec
- but I can't see how to get the required
KotlinJsCompilation
instance https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsExec.kt