mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
feat(install): option to disable fast reinstall (#8977)
This commit is contained in:
7
.changeset/neat-bobcats-raise.md
Normal file
7
.changeset/neat-bobcats-raise.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": minor
|
||||
"@pnpm/config": minor
|
||||
"pnpm": minor
|
||||
---
|
||||
|
||||
Added a new setting called `optimistic-repeat-install`. When enabled, a fast check will be performed before proceeding to installation. This way a repeat install or an install on a project with everything up-to-date becomes a lot faster. But some edge cases might arise, so we keep it disabled by default for now [#8977](https://github.com/pnpm/pnpm/pull/8977).
|
||||
@@ -45,6 +45,7 @@ export interface Config {
|
||||
ignoreScripts?: boolean
|
||||
ignoreCompatibilityDb?: boolean
|
||||
includeWorkspaceRoot?: boolean
|
||||
optimisticRepeatInstall?: boolean
|
||||
save?: boolean
|
||||
saveProd?: boolean
|
||||
saveDev?: boolean
|
||||
|
||||
@@ -147,6 +147,7 @@ export async function getConfig (opts: {
|
||||
'hoist-workspace-packages': true,
|
||||
'ignore-workspace-cycles': false,
|
||||
'ignore-workspace-root-check': false,
|
||||
'optimistic-repeat-install': false,
|
||||
'inject-workspace-packages': false,
|
||||
'link-workspace-packages': false,
|
||||
'lockfile-include-tarball-url': false,
|
||||
|
||||
@@ -42,6 +42,7 @@ export const types = Object.assign({
|
||||
'ignore-workspace': Boolean,
|
||||
'ignore-workspace-cycles': Boolean,
|
||||
'ignore-workspace-root-check': Boolean,
|
||||
'optimistic-repeat-install': Boolean,
|
||||
'include-workspace-root': Boolean,
|
||||
'inject-workspace-packages': Boolean,
|
||||
'legacy-dir-filtering': Boolean,
|
||||
|
||||
@@ -29,6 +29,7 @@ export function rcOptionsTypes (): Record<string, unknown> {
|
||||
'https-proxy',
|
||||
'ignore-pnpmfile',
|
||||
'ignore-scripts',
|
||||
'optimistic-repeat-install',
|
||||
'link-workspace-packages',
|
||||
'lockfile-dir',
|
||||
'lockfile-directory',
|
||||
@@ -114,6 +115,10 @@ For options that may be used with `-r`, see "pnpm help recursive"',
|
||||
name: '--dev',
|
||||
shortAlias: '-D',
|
||||
},
|
||||
{
|
||||
description: 'Skip reinstall if the workspace state is up-to-date',
|
||||
name: '--optimistic-repeat-install',
|
||||
},
|
||||
{
|
||||
description: '`optionalDependencies` are not installed',
|
||||
name: '--no-optional',
|
||||
|
||||
@@ -65,6 +65,7 @@ export type InstallDepsOptions = Pick<Config,
|
||||
| 'ignoreCurrentPrefs'
|
||||
| 'ignorePnpmfile'
|
||||
| 'ignoreScripts'
|
||||
| 'optimisticRepeatInstall'
|
||||
| 'linkWorkspacePackages'
|
||||
| 'lockfileDir'
|
||||
| 'lockfileOnly'
|
||||
@@ -138,7 +139,7 @@ export async function installDeps (
|
||||
opts: InstallDepsOptions,
|
||||
params: string[]
|
||||
): Promise<void> {
|
||||
if (!opts.update && !opts.dedupe && params.length === 0) {
|
||||
if (!opts.update && !opts.dedupe && params.length === 0 && opts.optimisticRepeatInstall) {
|
||||
const { upToDate } = await checkDepsStatus({
|
||||
...opts,
|
||||
ignoreFilteredInstallCache: true,
|
||||
|
||||
Reference in New Issue
Block a user