Joe Gornick

Publish a scoped package to a custom registry

When publishing a npm package, npm will use your configuration sources for a destination registry. npm also provides an ability to override configuration via the publishConfig field in package.json.

If your package is non-scoped, then you can override the publish npm registry:

{
  "publishConfig": {
    "registry": "https://npm.joegornick.com"
  }
}

However, if your package is scoped, then there’s an undocumented ability to override the publish npm registry by prefixing registry with the @scope:

{
  "publishConfig": {
    "@foo:registry": "https://npm.foo.com"
  }
}

References

No way to override registry in .npmrc for scoped packages w/–registry flag

comments powered by Disqus