diff --git a/lib/cli.js b/lib/cli.js index 35129702..30d8c448 100755 --- a/lib/cli.js +++ b/lib/cli.js @@ -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: { @@ -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(), @@ -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) { diff --git a/lib/out/install-packages.js b/lib/out/install-packages.js index a960f191..3e3a9643 100644 --- a/lib/out/install-packages.js +++ b/lib/out/install-packages.js @@ -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(''); diff --git a/lib/state/state.js b/lib/state/state.js index d4bb3d72..bd5074a4 100644 --- a/lib/state/state.js +++ b/lib/state/state.js @@ -20,6 +20,7 @@ const defaultOptions = { spinner: false, installer: 'npm', ignore: [], + legacyPeerDeps: false, globalPackages: {}, cwdPackageJson: {devDependencies: {}, dependencies: {}},