npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Force registry on publish (overriding publishConfig)

I have 2 private registries that I need to publish a package, the main registry is declared on publishConfig, but time to time I need to publish to the other one. Currently there’s no way (that I know of) to publish to the other registry without removing the registry from publishConfig. My idea is a new boolean flag --force-registry that in conjuction with --registry would override the package.json registry configuration

npm publish --registry= --force-registry

Another idea more generic is to pass a json argument to be merged with priority with the config, something like --override-config

npm publish --override-config '{"registry": ""}'

I could work on a pull-request if we decide about implementing it

I also need this kind of feature to overwirte the registry with existing publishConfig

I would prefer: npm publish --override-config