diff --git a/.changeset/selfish-icons-beam.md b/.changeset/selfish-icons-beam.md new file mode 100644 index 00000000000..ac4700e75b5 --- /dev/null +++ b/.changeset/selfish-icons-beam.md @@ -0,0 +1,7 @@ +--- +"@pnpm/plugin-commands-installation": minor +"@pnpm/core": minor +"pnpm": minor +--- + +`pnpm install --resolution-only` re-runs resolution to print out any peer dependency issues [#6411](https://github.com/pnpm/pnpm/pull/6411). diff --git a/pkg-manager/core/src/install/extendInstallOptions.ts b/pkg-manager/core/src/install/extendInstallOptions.ts index 5ccb4a0fca5..7948b6233c7 100644 --- a/pkg-manager/core/src/install/extendInstallOptions.ts +++ b/pkg-manager/core/src/install/extendInstallOptions.ts @@ -35,6 +35,7 @@ export interface StrictInstallOptions { mergeGitBranchLockfiles: boolean linkWorkspacePackagesDepth: number lockfileOnly: boolean + forceFullResolution: boolean fixLockfile: boolean dedupe: boolean ignoreCompatibilityDb: boolean @@ -142,6 +143,7 @@ const defaults = async (opts: InstallOptions) => { enablePnp: false, engineStrict: false, force: false, + forceFullResolution: false, forceSharedLockfile: false, frozenLockfile: false, hoistPattern: undefined, diff --git a/pkg-manager/core/src/install/index.ts b/pkg-manager/core/src/install/index.ts index 37c6992ec57..8fec00f2eca 100644 --- a/pkg-manager/core/src/install/index.ts +++ b/pkg-manager/core/src/install/index.ts @@ -318,7 +318,8 @@ export async function mutateModules ( patchedDependencies, }) || opts.fixLockfile || - !ctx.wantedLockfile.lockfileVersion.toString().startsWith('6.') + !ctx.wantedLockfile.lockfileVersion.toString().startsWith('6.') || + opts.forceFullResolution if (needsFullResolution) { ctx.wantedLockfile.overrides = opts.overrides ctx.wantedLockfile.neverBuiltDependencies = opts.neverBuiltDependencies diff --git a/pkg-manager/plugin-commands-installation/src/install.ts b/pkg-manager/plugin-commands-installation/src/install.ts index f216ef040a2..04c9d1b0516 100644 --- a/pkg-manager/plugin-commands-installation/src/install.ts +++ b/pkg-manager/plugin-commands-installation/src/install.ts @@ -6,7 +6,7 @@ import { type CreateStoreControllerOptions } from '@pnpm/store-connection-manage import { isCI } from 'ci-info' import pick from 'ramda/src/pick' import renderHelp from 'render-help' -import { installDeps } from './installDeps' +import { installDeps, type InstallDepsOptions } from './installDeps' export function rcOptionsTypes () { return pick([ @@ -74,6 +74,7 @@ export const cliOptionsTypes = () => ({ ...rcOptionsTypes(), ...pick(['force'], allTypes), 'fix-lockfile': Boolean, + 'resolution-only': Boolean, recursive: Boolean, }) @@ -228,6 +229,10 @@ Install all optionalDependencies even they don\'t satisfy the current environmen description: 'Only use the side effects cache if present, do not create it for new packages', name: '--side-effects-cache-readonly', }, + { + description: 'Re-runs resolution: useful for printing out peer dependency issues', + name: '--resolution-only', + }, ...UNIVERSAL_OPTIONS, ], }, @@ -296,6 +301,7 @@ export type InstallCommandOptions = Pick