https://github.com/vanioinformatika/node-npmrc-auth-token-retriever
Retrieve auth token from .npmrc file base on provided registry URL
https://github.com/vanioinformatika/node-npmrc-auth-token-retriever
nodejs npm npmrc
Last synced: 4 months ago
JSON representation
Retrieve auth token from .npmrc file base on provided registry URL
- Host: GitHub
- URL: https://github.com/vanioinformatika/node-npmrc-auth-token-retriever
- Owner: vanioinformatika
- Created: 2019-02-28T15:47:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:15:12.000Z (almost 3 years ago)
- Last Synced: 2024-04-14T06:37:35.175Z (over 1 year ago)
- Topics: nodejs, npm, npmrc
- Language: TypeScript
- Size: 122 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/vanioinformatika/node-npmrc-auth-token-retriever)
Search auth token inside `.npmrc` file base on registry URL.
## Installation
```
npm install @vanioinformatika/npmrc-auth-token-retriever --save
```## Usage
**From CLI:**
```
npx retrieve-auth-token --registry private-registry.organization.com
```**From node:**
```javascript
import {retrieveAuthToken} from '@vanioinformatika/npmrc-auth-token-retriever'const token = retrieveAuthToken('private-registry.organization.com')
if (token) {
// Do something with token
} else {
// Token not found in .npmrc file
}
```If registry is not set, then default npmjs registry will be used (`registry.npmjs.org`).
> **Note:** Typescript declaration files are included in package.