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-dependency-switcher

v1.0.8

Published

Switch dependencies between local file: paths (dev) and npm versions (prod) using a simple config.

Readme

# npm-dependency-switcher

Small CLI tool to switch npm dependencies between local file paths and regular npm versions.

Typical use case:

  • In Dev mode, libraries from local repositories (file:../…) are used.
  • In Prod mode, the same packages are integrated via the current version from the npm registry (^1.0.4 etc.).

The tool:

  • adapts your package.json
  • optionally cleans up node_modules + package-lock.json
  • then automatically executes npm install

Installation

npm install --save-dev npm-dependency-switcher
# oder
yarn add --dev npm-dependency-switcher
# oder
pnpm add -D npm-dependency-switcher

Setup

Create a file named npm-dependency-switcher.config.json in the project root.

{
  "packages": [
    {
      "name": "sftp-push-sync",
      "version":"",
      "localPath": "../../../sftp-push-sync/production/sftp-push-sync"
    },
    {
      "name": "hugo-update-lastmod",
      "localPath": "../../../hugo-update-lastmod/production/hugo-update-lastmod"
    },
    {
      "name": "hugo-clean-cache",
      "localPath": "../../../hugo-clean-cache/production/hugo-clean-cache"
    }
  ]
}

with

  • name - Must match the dependency name in your package.json exactly.
  • version -Desired version/range (e.g. "1.2.3" or "^1.2.3" or "~1.0.0" etc.) If version is missing or contains an empty string, the latest version is retrieved and entered as ^<latest>.
  • localPath - Is the local path to be set in dev mode. Typically a file path to a neighbouring repo or a production build.

cli

  • npm-dependency-switcher <mode> [--config <path>]
    • with <mode>:
      • dev → Set local file path dependencies
      • prod → Set npm dependencies to the latest version (^x.y.z)
    • --config (optional): Path to the configuration file. Default: npm-dependency-switcher.config.json in the current working directory.

Add scripts to package.json:

{
  "scripts": {
    "switch:dev": "npm-dependency-switcher dev",
    "switch:prod": "npm-dependency-switcher prod"
  }
}

use:

# Using local repositories
npm run switch:dev

# Switch to npm packages (latest versions)
npm run switch:prod

Check out package.json to see how the entries change and enjoy :-)

switches from:

  "dependencies": {
    "picocolors": "^1.1.1",
    "hugo-clean-cache": "file:../../../hugo-clean-cache/production/hugo-clean-cache",
    "hugo-update-lastmod": "file:../../../hugo-update-lastmod/production/hugo-update-lastmod",
    "hugo-broken-links-checker": "file:../../../hugo-broken-links-checker/production/hugo-broken-links-checker",
    "sftp-push-sync": "file:../../../sftp-push-sync/production/sftp-push-sync"
  },

to this.

  "dependencies": {
    "picocolors": "^1.1.1",
    "hugo-clean-cache": "^1.0.1",
    "hugo-update-lastmod": "^1.0.7",
    "hugo-broken-links-checker": "^1.0.3",
    "sftp-push-sync": "^1.0.18"
  },

vice versa.