Gets credentials for URI from npm configs
pnpm add credentials-by-uri
const credentialsByUri = require('credentials-by-uri')
const config = {
registry: 'https://registry.npmjs.com',
'//registry.com/:_authToken': 'f23jj93f32dsaf==',
'//registry.com/:always-auth': 'false'
}
console.log(
credentialsByUri(config, 'https://registry.com')
)
> { authHeaderValue: 'Bearer f23jj93f32dsaf==', alwaysAuth: false }
- registry-auth-token - Get the auth token set for an npm registry