The docs read a bit like the developer is supposed to give over all "package registry duties" to AWS CodeArtifact. But I want to continue using npm.org for some packages.
Given a javascript app that uses private and public packages, can I setup npm/AWS so:
There is way to explicitly set two npm registries, therefore achieving what you want.
Instead of using aws codeartifact login --tool npm --repository my-repo --domain my-domain
to login into aws you should use a more granular approach use the following commands:
# get endpoint
endpoint = aws codeartifact get-repository-endpoint --domain my_domain --domain-owner 111122223333 --repository my_repo --format npm
# set a scoped registry
npm config set registry endpoint --scope=@my-package
# get token
token = aws codeartifact get-authorization-token --domain my_domain --domain-owner 111122223333 --repository my_repo
# set token
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:_authToken=token
# always truth
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:always-auth=true
These commands are a deconstruction of aws codeartifact login --tool npm --repository my-repo --domain my-domain
(more info), with the difference that instead of setting a general registry
at your .npmrc
file (used to set configurations for your npm) will set a scoped registry (more info).
In this way you will be able to have you fetch your packages from the sources you want.
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