0

Assume in my package.json I have a task named "xxx".

Using npm 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.

Using gradle-node-plugin, I can run it via Gradle using ./gradlew npm_run_xxx.

But is there a way to pass those additional arguments to the npm task, like I've done above with npm right on the Gradle command line?

What I've tried, and it doesn't work: ./gradlew npm_run_xxx --args="more args".

ivan.ukr
  • 2,853
  • 1
  • 23
  • 41

1 Answers1

0

I believe you add them into the Gradle script as defined here: https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/usage.md

Gradle (Groovy):

npm_update {
  args = ['--production', '--loglevel', 'warn']
}

Gradle (Kotlin):

tasks.named<NpmTask>("npm_update") {
  args.set(listOf("--production", "--loglevel", "warn"))
}
Julian
  • 317
  • 3
  • 9