I’m working on a project where we need to handle two different npm registry setups for separate teams.
Current Setup for Team A:
We’re running a Nexus OSS instance that acts as our private npm registry. Our configuration includes a combined repository called npm-combined which contains both a proxy to the public npm registry and our private packages.
Our current .npmrc looks like this:
registry=http://our-nexus-server/repository/npm-combined/
always-auth=true
//our-nexus-server:_authToken=abc.def.ghi.jkl
Upcoming Team B Requirements:
Team B will be joining the project soon and they have their own official npm enterprise account with a different authentication token:
//registry.npmjs.org/:_authToken=mno.pqr.stu.vwx
The Challenge:
I need to figure out how to combine these two configurations in a single .npmrc file so both teams can work on the same codebase without conflicts.
I’m considering a few approaches:
- Using npm scopes to separate the registries
- Removing the proxy setup from our Nexus configuration
- Simply combining both auth tokens like this:
registry=http://our-nexus-server/repository/npm-combined/
always-auth=true
//our-nexus-server:_authToken=abc.def.ghi.jkl
//registry.npmjs.org/:_authToken=mno.pqr.stu.vwx
What’s the best approach to handle this multi-registry scenario?