best-vsts-npm-auth
v1.0.0
Published
The best VSTS NPM Auth tool
Readme
Best VSTS NPM Auth
Refresh Azure DevOps Artifacts (ADO) npm authentication on your machine.
- Reads your project
.npmrc(and any scoped registries). - Gets an ADO access token via Azure CLI (no app registration required).
- Writes short-lived tokens to your user
~/.npmrc(and optionally project.yarnrc.yml).
Prerequisites
- Node.js + npm
- Azure CLI installed and logged in:
az loginIf your org requires a specific tenant, set AZURE_TENANT_ID:
export AZURE_TENANT_ID="<your-tenant-guid>"Install
Option A: Install from npm (recommended)
npm i -g best-vsts-npm-authOption B: Install from a GitHub release tarball
- Download
best-vsts-npm-auth-<version>.tgzfrom your Releases page. - Install it globally:
npm i -g /path/to/best-vsts-npm-auth-<version>.tgzRun
Process the local project .npmrc:
best-vsts-npm-auth .Process a specific .npmrc:
best-vsts-npm-auth -n /path/to/.npmrcAlso update Yarn Berry config:
best-vsts-npm-auth -y ./.yarnrc.yml .Notes
- ADO access tokens are typically valid for ~1 hour. Re-run the tool (or mint a new token) if you see
401. - Tokens are written only to the user
~/.npmrc(not your project.npmrc) unless you intentionally configure otherwise.
