Open IvanPizhenko opened 1 year ago
Do you need these to be generic or is there a different set of them? If you've got a set of them you can do something like the following for each:
tasks.register('myNpmTask', NpmTask) {
args = ['run', 'task', 'args']
inputs.dir('src') // Remember to declare inputs and outputs
outputs.dir('dist')
}
Otherwise if you need it to be dynamic you can either subclass NpmTask
and add a command-line argument or make use of project properties in the args
But this project supplying a generalized NpmRunTask
might make sense here 🤔
Assume in my
package.json
I have a task named "xxx". Usingnpm
itself, I can run it as follows:npm run xxx
. I also can run it with additional arguments in the following way:npm run xxx -- more arguments for xxx
. When I run this task using node plugin for Gradle, I can run it using./gradlew npm_run_xxx
. But is there a way to pass those additional arguments to the npm task, like I've done above withnpm
right on the Gradle command line?