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

feat: resolution-only #6411

Merged
merged 2 commits into from Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .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).
2 changes: 2 additions & 0 deletions pkg-manager/core/src/install/extendInstallOptions.ts
Expand Up @@ -35,6 +35,7 @@ export interface StrictInstallOptions {
mergeGitBranchLockfiles: boolean
linkWorkspacePackagesDepth: number
lockfileOnly: boolean
forceFullResolution: boolean
fixLockfile: boolean
dedupe: boolean
ignoreCompatibilityDb: boolean
Expand Down Expand Up @@ -142,6 +143,7 @@ const defaults = async (opts: InstallOptions) => {
enablePnp: false,
engineStrict: false,
force: false,
forceFullResolution: false,
forceSharedLockfile: false,
frozenLockfile: false,
hoistPattern: undefined,
Expand Down
3 changes: 2 additions & 1 deletion pkg-manager/core/src/install/index.ts
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions pkg-manager/plugin-commands-installation/src/install.ts
Expand Up @@ -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([
Expand Down Expand Up @@ -74,6 +74,7 @@ export const cliOptionsTypes = () => ({
...rcOptionsTypes(),
...pick(['force'], allTypes),
'fix-lockfile': Boolean,
'resolution-only': Boolean,
recursive: Boolean,
})

Expand Down Expand Up @@ -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,
],
},
Expand Down Expand Up @@ -296,6 +301,7 @@ export type InstallCommandOptions = Pick<Config,
pruneDirectDependencies?: boolean
pruneStore?: boolean
recursive?: boolean
resolutionOnly?: boolean
saveLockfile?: boolean
workspace?: boolean
includeOnlyPackageFiles?: boolean
Expand All @@ -309,12 +315,17 @@ export async function handler (
devDependencies: opts.dev !== false,
optionalDependencies: opts.optional !== false,
}
return installDeps({
const installDepsOptions: InstallDepsOptions = {
...opts,
frozenLockfileIfExists: isCI && !opts.lockfileOnly &&
typeof opts.rawLocalConfig['frozen-lockfile'] === 'undefined' &&
typeof opts.rawLocalConfig['prefer-frozen-lockfile'] === 'undefined',
include,
includeDirect: include,
}, [])
}
if (opts.resolutionOnly) {
installDepsOptions.lockfileOnly = true
installDepsOptions.forceFullResolution = true
}
return installDeps(installDepsOptions, [])
}
Expand Up @@ -85,6 +85,7 @@ export type InstallDepsOptions = Pick<Config,
original: string[]
}
allowNew?: boolean
forceFullResolution?: boolean
frozenLockfileIfExists?: boolean
include?: IncludedDependencies
includeDirect?: IncludedDependencies
Expand Down