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 🙏

© 2024 – Pkg Stats / Ryan Hefner

install-peerdeps

v3.0.3

Published

CLI to automatically install peerDeps

Downloads

110,730

Readme

install-peerdeps

As seen on the README of Airbnb's ESLint config!

Disclaimer: Airbnb is not affiliated with, and does not endorse, this CLI tool

Build Status Dependency Status devDependency Status

npm total downloads npm monthly downloads GitHub stars

Node version npm version GitHub license

A command-line interface to install an NPM package and its peer dependencies automatically.

Starting with NPM v3.0, peer dependencies are not automatically installed on npm install, and it can be a hassle to install them all manually. The install-peerdeps tool makes the process fast and easy.

Also works with Yarn.

Quick Start

# If you're using npm
npm install -g install-peerdeps

# If you're using yarn
yarn global add install-peerdeps

cd my-project-directory

install-peerdeps <package>[@<version>]

The specified package along with its peer dependencies will be installed.

Why

It's true that on Linux you can run something like this to automatically install peerDeps (taken from AirBnb's eslint config repo):

(
  export PKG=eslint-config-airbnb;
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)

However, the above solution is hard to remember, and doesn't work on Windows. This tool aims to solve both of these problems.

Usage

Usage: install-peerdeps <package>[@<version>], default version is 'latest'

Installs the specified package along with correct peerDeps.

Options:
  -V, --version                    output the version number
  -D                               Install the package as a devDependency (alias for `-d`)
  -d, --dev                        Install the package as a devDependency
  -g, --global                     Install the package globally
  -o, --only-peers                 Install only peerDependencies of the package
  -S, --silent                     If using npm, don't save in package.json
  -Y, --yarn                       Install with Yarn
  -P, --pnpm                       Install with pnpm
  -n, --no-registry                Do not use a remote registry to find dependencies list
  --dry-run                        Do not install packages, but show the install command that will be run
  -x, --extra-args "<extra_args>"  Extra arguments to pass through to NPM or Yarn
  -h, --help                       output usage information

Extra Arguments

Only core Yarn and NPM arguments relating to package installation are officially provided by install-peerdeps. However, if you'd like to pass through additional arguments, you may do so with --extra-args. Here's how you'd install a package into a Yarn-workspace-enabled repository:

install-peerdeps <package> --dev -Y --extra-args "-W"

Here's how you'd use --extra-args to pass a custom NPM config option (in this case, disabling strict-ssl when accessing a custom registry over HTTPS):

install-peerdeps <package> --extra-args "--strict-ssl false"

Examples

Basic Peer Dependency Installation

eslint-config-airbnb requires quite a few peer dependencies. Here's what you'd do to install them all:

install-peerdeps eslint-config-airbnb --dev

install-peerdeps will automatically detect whether you're using Yarn. If you are, it'll prompt you as to whether you want to use Yarn or npm to install the packages.

# If you're using npm
npm install eslint-config-airbnb eslint@^3.9.1 eslint-plugin-jsx-a11y@^2.2.3 eslint-plugin-import@^2.1.0 eslint-plugin
-react@^6.6.0 --save-dev

# If you're using yarn
yarn add eslint-config-airbnb eslint@^3.9.1 eslint-plugin-jsx-a11y@^2.2.3 eslint-plugin-import@^2.1.0 eslint-plugin
-react@^6.6.0 --dev

Installing a Different Version Tag

If you'd like to install a different version of a package than the latest (the default), simply specify the version like so:

install-peerdeps @angular/core@next

The tool will automatically install the version corresponding to the tag, as well as its peer dependencies:

...
Installing peerdeps for @angular/[email protected].
yarn add @angular/core rxjs@^5.0.1 zone.js@^0.7.2

yarn add v0.18.1
...

Contributing

See CONTRIBUTING.md

License

MIT