Closed lhhong closed 1 year ago
This is unfortunately a flaw in the documentation (see https://github.com/node-gradle/gradle-node-plugin/issues/208)
args
is a Property and while you cannot re-assign it, you can query and change the value of the property (see Lazy Configuration for more information)
Dropping the doFirst {}
should make this work again, I think this is just a remnant from the old version of the plugin and should be fixed.
I'll go through the FAQ tonight and fix things, and while I greatly appreciate the PR I can unfortunately not accept it because of the semantics behind Lazy properties, I would happily accept a PR updating this entry in the FAQ 🙂
Thanks! That works. PR-ed an update to the FAQ.
So I tried this https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/faq.md#how-do-i-specify-a-registry-for-the-npm-setup-task but changing
npmSetup
toyarnSetup
but was hit with "property 'args' is final and cannot be changed any further."Looks like the
YarnSetupTask
did not allow overriding of args: https://github.com/node-gradle/gradle-node-plugin/blob/4eda1f3952e8539252941e113eb32cfbca31298e/src/main/kotlin/com/github/gradle/node/yarn/task/YarnSetupTask.kt making this not possible. The only workaround right now is to include.npmrc
in the npm working directory but is not ideal because we cannot then bundle the registry with repository. It becomes a manual step for the developer.