Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds support for legacy-peer-deps flag on npm install #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,24 @@ const cli = meow({
Where to check. Defaults to current directory. Use -g for checking global modules.

Options
-u, --update Interactive update.
-y, --update-all Uninteractive update. Apply all updates without prompting.
-g, --global Look at global modules.
-s, --skip-unused Skip check for unused packages.
-p, --production Skip devDependencies.
-d, --dev-only Look at devDependencies only (skip dependencies).
-i, --ignore Ignore dependencies based on succeeding glob.
-E, --save-exact Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.
--specials List of depcheck specials to include in check for unused dependencies.
--no-color Force or disable color output.
--no-emoji Remove emoji support. No emoji in default in CI environments.
--debug Debug output. Throw in a gist when creating issues on github.
-u, --update Interactive update.
-y, --update-all Uninteractive update. Apply all updates without prompting.
-g, --global Look at global modules.
-s, --skip-unused Skip check for unused packages.
-p, --production Skip devDependencies.
-d, --dev-only Look at devDependencies only (skip dependencies).
-i, --ignore Ignore dependencies based on succeeding glob.
-E, --save-exact Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.
-l, --legacy-peer-deps Disable automatic installation of peer dependencies.
--specials List of depcheck specials to include in check for unused dependencies.
--no-color Force or disable color output.
--no-emoji Remove emoji support. No emoji in default in CI environments.
--debug Debug output. Throw in a gist when creating issues on github.

Examples
$ npm-check # See what can be updated, what isn't being used.
$ npm-check ../foo # Check another path.
$ npm-check -gu # Update globally installed modules by picking which ones to upgrade.
$ npm-check # See what can be updated, what isn't being used.
$ npm-check ../foo # Check another path.
$ npm-check -gu # Update globally installed modules by picking which ones to upgrade.
`},
{
alias: {
Expand All @@ -52,7 +53,8 @@ const cli = meow({
p: 'production',
d: 'dev-only',
E: 'save-exact',
i: 'ignore'
i: 'ignore',
l: 'legacy-peer-deps'
},
default: {
dir: pkgDir.sync() || process.cwd(),
Expand Down Expand Up @@ -91,7 +93,8 @@ const options = {
installer: process.env.NPM_CHECK_INSTALLER || 'auto',
debug: cli.flags.debug,
spinner: cli.flags.spinner,
ignore: cli.flags.ignore
ignore: cli.flags.ignore,
legacyPeerDeps: cli.flags.legacyPeerDeps
};

if (options.debug) {
Expand Down
2 changes: 2 additions & 0 deletions lib/out/install-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ function install(packages, currentState) {
const installGlobal = currentState.get('global') ? '--global' : null;
const saveExact = currentState.get('saveExact') ? '--save-exact' : null;
const color = chalk.supportsColor ? '--color=always' : null;
const legacyPeerDeps = currentState.get("legacyPeerDeps") ? "--legacy-peer-deps" : null;

const npmArgs = ['install']
.concat(installGlobal)
.concat(saveExact)
.concat(packages)
.concat(color)
.concat(legacyPeerDeps)
.filter(Boolean);

console.log('');
Expand Down
1 change: 1 addition & 0 deletions lib/state/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const defaultOptions = {
spinner: false,
installer: 'npm',
ignore: [],
legacyPeerDeps: false,

globalPackages: {},
cwdPackageJson: {devDependencies: {}, dependencies: {}},
Expand Down