npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rb-mwindh/setup-npm-auth

v1.2.7

Published

CLI to discover configured npm registries write authToken to user config

Readme

setup-npm-auth

npm version

A CLI and GitHub Action to discover configured npm registries and write authentication tokens to the npm user config. Supports default, publish, and scoped registries. Designed for use in CI/CD pipelines and local development.

Features

  • Discovers all configured npm registries (default, publishConfig, and @scope registries)
  • Writes authentication tokens to the correct npm config location
  • Supports dry-run and verbose modes
  • Usable as a CLI or as a declarative GitHub Action

Usage

CLI

Install globally or use via npx:

npx @rb-mwindh/setup-npm-auth --include default --include publish=PUBLISH_TOKEN --include @myscope=SCOPE_TOKEN

Options

  • --include <scope>[=<ENV_VAR>]
    Include a registry. Repeatable. Grammar: default, publish, or @scope[=ENV_VAR]. Defaults to NODE_AUTH_TOKEN if ENV_VAR is omitted.
  • -L, --location <global|project|user>
    Specify npm config location. Defaults to user-level config.
  • --dry-run
    Show what would be configured, but do not write anything.
  • -v, --verbose
    Show detailed output.

Examples

# Set auth for the default registry using NODE_AUTH_TOKEN
NODE_AUTH_TOKEN=foo npx @rb-mwindh/setup-npm-auth

# Set auth for default and publishConfig.registry using the same token from NODE_AUTH_TOKEN
NODE_AUTH_TOKEN=foo PUBLISH_TOKEN=bar npx @rb-mwindh/setup-npm-auth --include default --include publish

# Set auth for default and publishConfig.registry using different env vars
NODE_AUTH_TOKEN=foo PUBLISH_TOKEN=bar npx @rb-mwindh/setup-npm-auth --include default --include publish=PUBLISH_TOKEN

# Set auth for a scoped registry
SCOPE_TOKEN=abc npx @rb-mwindh/setup-npm-auth --include @myscope=SCOPE_TOKEN

# Use a specific npm config location (e.g. user)
NODE_AUTH_TOKEN=foo npx @rb-mwindh/setup-npm-auth -L user

# Show what would be configured, but do not write anything
NODE_AUTH_TOKEN=foo npx @rb-mwindh/setup-npm-auth --dry-run

# Show planned configuration details before execution
NODE_AUTH_TOKEN=foo npx @rb-mwindh/setup-npm-auth --verbose

GitHub Action

You can use this tool as a declarative GitHub Action in your workflows:

- uses: rb-mwindh/setup-npm-auth@main
  with:
    verbose: 'true'
    includes: |
      default
      publish=PUBLISH_TOKEN
      @myscope=SCOPE_TOKEN

Action Inputs

  • includes: Registries to include (e.g. default, publish, @scope=ENV)
  • location: npm config location (user, global, project)
  • dry-run: Show what would be done, but do not execute
  • verbose: Show more output

Development

Building the Action

This action uses @vercel/ncc to bundle all runtime dependencies into a single file. The bundled output is committed to the repository in the dist/ directory because GitHub Actions require all code and dependencies to be present in the repository.

To build the action after making changes:

npm ci
npm run build

The dist/ directory is intentionally committed to version control, as this is required for JavaScript GitHub Actions to work on self-hosted runners without requiring npm install.

License

MIT © Markus Windhager