gradle-node-plugin
gradle-node-plugin copied to clipboard
Support custom registry from project .npmrc in NpmSetupTask
The NpmSetupTask does not obey to the custom registry defined in .npmrc file of the project.
An ~/.npmrc does work, but it would be nice if the custom registry defined in the project specific .npmrc would als be used for NpmSetupTask.
Workaround is to use args to configure a custom registry.
I just had a similar case. You could also use args to configure the .npmrc file you want to use. Like this:
tasks.named("npmSetup") {
args.addAll(['--userconfig', "${project.projectDir}/.npmrc"])
}
But then you would not have the normal user config considered.
Besides that you can then right away use the args to configure the custom repository if you need to configure anyway. :-)
I just wanted to mention this solution as an alternative. I'm using a custom registry together with the _auth config. So, I needed to include the whole .npmrc file instead of just adding --registry.
But you're right, it would be nice if the project file would be used automatically.