npm provides a great way of associating a scope with a registry but I don't really see it working with AWS CodeArtifact.
I expect that once you created a domain @myco and a couple of repositories under that domain, ex: @myco/repo-a & @myco/repo-b I would be able to:
npm config set @myco:registry https://888999.d.codeartifact.eu-central-1.amazonaws.com/npm/
npm config set //888999.d.codeartifact.eu-central-1.amazonaws.com/npm/:_authToken=xxx
and all repositories could be installed with the same authToken, but aws codeartifact login expects repository which makes me think that it's not possible to install 2 private repos using one token.
Any ideas?
The root of my confusion was an assumption that AWS CodeArtifact has the following hierarchy:
In fact, it's slightly different:
As result generated token works as expected if we configure global .npmrc like this:
registry=https://registry.npmjs.com/
@myco:registry=https://xxx.d.codeartifact.region.amazonaws.com/npm/registry/
//xxx.d.codeartifact.region.amazonaws.com/npm/registry/:always-auth=true
//xxx.d.codeartifact.region.amazonaws.com/npm/registry/:_authToken=${CODEARTIFACT_AUTH_TOKEN}
That works for both default npm registry and your own.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With