Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify registry for yarnSetup task #253

Closed
lhhong opened this issue Dec 8, 2022 · 2 comments · Fixed by #256
Closed

Unable to specify registry for yarnSetup task #253

lhhong opened this issue Dec 8, 2022 · 2 comments · Fixed by #256

Comments

@lhhong
Copy link
Contributor

lhhong commented Dec 8, 2022

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 to yarnSetup 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.

@deepy
Copy link
Member

deepy commented Dec 8, 2022

This is unfortunately a flaw in the documentation (see #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 🙂

@lhhong
Copy link
Contributor Author

lhhong commented Dec 13, 2022

Thanks! That works. PR-ed an update to the FAQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants