Convenience module and CLI for extracting the auth token from your ~/.npmrc file
Hey! If you know of a better way to do this, please let me know.
Install it locally:
npm i get-auth-token-from-npmrc --save
Then in your JS file:
const token = require('get-auth-token-from-npmrc')()
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
If ~/.npmrc
exists and you're logged in to npm, a token is returned.
Otherwise, null
is returned.
Install it globally (or locally depending on your use-case):
npm i -g get-auth-token-from-npmrc && get-auth-token-from-npmrc
The token is written to stdout.
None
None
MIT