@verdaccio/registry-cli
v1.1.0
Published
CLI tool for Verdaccio registries — non-interactive login, whoami with groups, and health checks
Readme
@verdaccio/registry-cli
CLI tool for Verdaccio registries — non-interactive login, user info with groups, and health checks.
Zero dependencies. Works with any Verdaccio auth plugin (htpasswd, LDAP, Azure AD, etc.).
Installation
# Use directly with npx
npx @verdaccio/registry-cli login -u admin -p secret
# Or install globally
npm install -g @verdaccio/registry-cliCommands
login — Authenticate to a registry
Non-interactive login — ideal for CI/CD pipelines.
# Username + password
verdaccioctl login -u admin -p secret -r http://localhost:4873
# With email
verdaccioctl login -u admin -p secret -e [email protected] -r http://localhost:4873
# Token-based (Azure AD, OIDC, JWT)
verdaccioctl login --token eyJhbGciOi... -r http://localhost:4873The token is written to ~/.npmrc automatically.
whoami — Show current user and groups
verdaccioctl whoami -r http://localhost:4873
# Username: admin
# Groups: admins, developers
# Registry: http://localhost:4873ping — Check if registry is reachable
verdaccioctl ping -r http://localhost:4873
# Registry: http://localhost:4873
# Status: OK
# Time: 12msReturns exit code 1 if unreachable — useful in CI health checks.
Options
| Option | Short | Description |
| ------------------- | ----- | -------------------------------------------------- |
| --registry <url> | -r | Registry URL (default: http://localhost:4873) |
| --username <user> | -u | Username (login only) |
| --password <pass> | -p | Password (login only) |
| --email <email> | -e | Email (login only, optional) |
| --token <token> | — | Pre-existing token for login (JWT, Azure AD, etc.) |
| --help | -h | Show help |
CI/CD Examples
GitHub Actions
- name: Login to Verdaccio
run: npx @verdaccio/registry-cli login -u ${{ secrets.NPM_USER }} -p ${{ secrets.NPM_PASS }} -r https://registry.company.com
- name: Publish
run: npm publish --registry https://registry.company.comAzure DevOps
- script: npx @verdaccio/registry-cli login -u $(NPM_USER) -p $(NPM_PASS) -r https://registry.company.com
displayName: Login to Verdaccio
- script: npm publish --registry https://registry.company.com
displayName: Publish packageGitLab CI
publish:
script:
- npx @verdaccio/registry-cli login -u $NPM_USER -p $NPM_PASS -r https://registry.company.com
- npm publish --registry https://registry.company.comDocker / Shell Scripts
#!/bin/bash
# Health check before publishing
verdaccioctl ping -r http://registry:4873 || exit 1
# Login
verdaccioctl login -u deploy -p "$DEPLOY_PASSWORD" -r http://registry:4873
# Verify identity
verdaccioctl whoami -r http://registry:4873
# Publish
npm publish --registry http://registry:4873Azure AD token login
# Get token from Azure CLI
TOKEN=$(az account get-access-token --resource api://your-client-id --query accessToken -o tsv)
# Login with token
verdaccioctl login --token "$TOKEN" -r https://registry.company.comProgrammatic API
All commands are also exported as functions:
import {login, loginWithToken, whoami, ping} from '@verdaccio/registry-cli';
await login({username: 'admin', password: 'secret', registry: 'http://localhost:4873'});
await loginWithToken('eyJhbG...', 'http://localhost:4873');
const user = await whoami('http://localhost:4873');
const health = await ping('http://localhost:4873');License
MIT
