• Stars
    star
    297
  • Rank 140,075 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 [email protected] eslint@^7.2.0 eslint-plugin-import@^2.22.1 eslint-plugin-jsx-a11y@^6.4.1 eslint-plugin-react@^7.21.5 eslint-plugin-react-hooks@^1.7.0 --save-dev

# If you're using yarn
yarn add [email protected] eslint@^7.2.0 eslint-plugin-import@^2.22.1 eslint-plugin-jsx-a11y@^6.4.1 eslint-plugin-react@^7.21.5 eslint-plugin-react-hooks@^1.7.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/core@next.
yarn add @angular/[email protected] rxjs@^6.5.3 zone.js@^0.11.3 --dev

Contributing

See CONTRIBUTING.md

License

MIT

More Repositories

1

fallback

💸 Write web apps in Solidity — a Solidity web framework / a proof-of-concept implementation of HTTP over Ethereum.
Solidity
163
star
2

angular2-todo-app

Angular 2 beta example todo app and tutorial
JavaScript
15
star
3

farolito

Guiding the way to government benefits. A project for the Out of Pocket AI Hackathon, June 2024 in San Francisco.
TypeScript
8
star
4

hexooor.natecation.xyz

⬢ Generate hexagonal Twitter NFT profile pictures client-side using HTML5 canvas: https://hexooor.natecation.xyz
TypeScript
7
star
5

schoology

check my grades
JavaScript
6
star
6

veryloudcloud

Learning/course-management system built with Node.js/MEAN stack
HTML
5
star
7

oganesson

A parser for chemical formula strings.
JavaScript
5
star
8

evmtx

TypeScript
5
star
9

grades.natecation.xyz

📊 Website with UCLA grade distributions from 2021-2023
TypeScript
5
star
10

element-bee

Node.js/Socket.io app for realtime periodic table quizzes
JavaScript
3
star
11

proactive-refresh-frontend

Frontend for the Proactive Refresh project submitted to TreeHacks 2023.
TypeScript
3
star
12

bukkit-web-wrapper

Node.js wrapper and authentication frontend for the Bukkit Minecraft server
JavaScript
3
star
13

print-anywhere

Network printing from anywhere via IPP
JavaScript
3
star
14

vuejs-user-management

Demo user management app written with Vue.js
HTML
3
star
15

schoology-bookmarklets

Chrome Extensions blocked? Use these bookmarklets to help navigate Schoology!
CSS
3
star
16

fake-twitter

fake twitter with nodejs standard lib
JavaScript
2
star
17

enlight-ycombinator

A writeup about the Y combinator for enlight.nyc
JavaScript
2
star
18

whsclubs

Check your club credit status with React and Flux
JavaScript
2
star
19

startum.co

StartUM (University of Michigan startup accelerator) website
JavaScript
2
star
20

jq-bgslider

A simple full-page jQuery background slider. Used on http://www.saffronofphilly.com/
JavaScript
2
star
21

fbball

Scrape Facebook Messenger to see who has the most baskets
JavaScript
2
star
22

natecation.xyz

Homepage for crypto projects.
HTML
2
star
23

doges-of-wallst

Algorithmic trading with cryptocurrencies
JavaScript
2
star
24

redux-bitcoin-price

Redux Bitcoin price tracker with async/await and fetch()
JavaScript
2
star
25

extension-warn-before-closing-canvas

Chrome extension that warns you before closing Canvas
JavaScript
2
star
26

resume

Nathan Leung's resume.
HTML
1
star
27

react-mobx-sine

React/MobX experiment, approximate trig functions
JavaScript
1
star
28

aplit-gatsby-project-website

Website for the Great Gatsby project in Mrs. Perlman's 2017-18 AP Literature class
HTML
1
star
29

node-basic

Basic node boilerplate
JavaScript
1
star
30

assets

HTML
1
star
31

ghost-runner

Ghost Runner App
CSS
1
star
32

euler-method-js

nice little website for euler's method
JavaScript
1
star
33

nodectf

A CTF platform written using Node.js, Express.js, and MongoDB.
JavaScript
1
star
34

apcs-quiz

Quiz app for APCS
1
star
35

help

i have no idea
1
star
36

javapaint

java paint program
Java
1
star
37

ionic-starter

Ionic Starter
JavaScript
1
star
38

vue-gradecalculator

Grade calculator app made with Vue 2 and Vuex
Vue
1
star
39

gci-checkers

Small Javascript checkers game
JavaScript
1
star
40

blog-old.nathanhleung.com

Old blog and website
CSS
1
star
41

books

Exercises from various books
Solidity
1
star
42

nathanhleung.github.io

Sets domain for project pages
HTML
1
star
43

strava

JavaScript
1
star
44

haskell-fun

fun with haskell
Haskell
1
star
45

school-java

Files from my Java programming class
HTML
1
star
46

nathanhleung

1
star
47

thedeviants.club

website for the deviants led by a$tro$hane
HTML
1
star
48

dominos-calculator

Domino's group pizza order calculator
HTML
1
star
49

canvas-fractals

Experiments with fractals using HTML5 <canvas>
JavaScript
1
star
50

pythag-live

live pythagorean theorem calculator built w vanilla.js!
JavaScript
1
star
51

miu-system

MIU system implementation in JS from Hofstadter's GEB
JavaScript
1
star
52

fellowship

HTML
1
star