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 🙏

© 2025 – Pkg Stats / Ryan Hefner

npm-to-cdn

v1.0.0

Published

A CLI tool to get CDN links for any npm package.

Readme

npm-to-cdn

Website
GitHub Coverage

A professional open-source Node.js CLI tool to instantly get CDN links for any npm package from major providers.


Features

  • Auto-discovers UMD files from CDN file listings (unpkg, jsDelivr)
  • Supports unpkg, jsDelivr, esm.sh, skypack
  • Minified/dev toggle: --min (default) or --dev
  • Batch mode: Query multiple packages at once
  • Clipboard: Copy first CDN link with --clipboard
  • JSON output: --json for machine-readable output
  • UMD-only: --umd for just unpkg/jsDelivr UMD links
  • Show all versions: --versions flag
  • Verbose/silent: --verbose for debug, --silent for CI
  • Graceful error handling

Installation

npm install -g npm-to-cdn

Usage

n2cdn react
n2cdn [email protected]
n2cdn axios --json
n2cdn vue --clipboard
n2cdn react@17 [email protected] --json --silent
n2cdn react --versions
n2cdn react@17 --umd --verbose
n2cdn vue@2 --dev --umd
n2cdn react --cdnjs
n2cdn react --statically user/repo/tag/dist/file.js
n2cdn react --bowercdn
n2cdn react --template "https://mycdn.com/{name}@{version}/{file}"

Flags

  • --json Output as JSON
  • --clipboard Copy first CDN link to clipboard
  • --umd Show only unpkg/jsDelivr UMD links
  • --min Prefer minified builds (default)
  • --dev Prefer development (non-minified) builds
  • --versions List all available versions for the package
  • --verbose Show all attempted URLs and debug info
  • --silent Suppress banner and only output links
  • --help Show help

Only valid CDN links are shown. UMD guessing is version-aware and auto-discovers from CDN file listings.


Supported CDN Providers

  • unpkg
  • jsDelivr
  • esm.sh
  • skypack
  • cdnjs
  • Statically (GitHub, GitLab, Bitbucket)
  • BowerCDN
  • Custom templates

Usage Examples

n2cdn react --cdnjs
n2cdn react --statically user/repo/tag/dist/file.js
n2cdn react --bowercdn
n2cdn react --template "https://mycdn.com/{name}@{version}/{file}"

CLI Improvements

  • All provider flags are now grouped and clearly documented
  • Input validation for statically flag
  • Consistent flag naming and help output

Example Output

$ n2cdn react@17 [email protected] --json --silent
[
  {
    "pkg": "react",
    "version": "17",
    "cdns": {
      "unpkg": "https://unpkg.com/react@17/umd/react.production.min.js",
      "jsDelivr": "https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js",
      "esmSh": "https://esm.sh/react@17",
      "skypack": "https://cdn.skypack.dev/react@17"
    }
  },
  {
    "pkg": "lodash",
    "version": "4.17.21",
    "cdns": {
      "esmSh": "https://esm.sh/[email protected]",
      "skypack": "https://cdn.skypack.dev/[email protected]"
    }
  }
]

Global Installation

This CLI is globally installable. After running:

npm install -g npm-to-cdn

You can use the n2cdn command anywhere.


Links


License

MIT

Planned Features

  • Support for more CDN providers
  • Custom CDN URL templates via CLI flag

Contributing

See CONTRIBUTING.md for how to get started.

Code of Conduct

This project follows the Contributor Covenant Code of Conduct.