diff --git a/pkg-manager/core/src/install/extendInstallOptions.ts b/pkg-manager/core/src/install/extendInstallOptions.ts index 7948b6233c7..7b24af7a97f 100644 --- a/pkg-manager/core/src/install/extendInstallOptions.ts +++ b/pkg-manager/core/src/install/extendInstallOptions.ts @@ -123,6 +123,7 @@ export interface StrictInstallOptions { dedupePeerDependents: boolean extendNodePath: boolean excludeLinksFromLockfile: boolean + confirmModulesPurge: boolean } export type InstallOptions = @@ -139,6 +140,7 @@ const defaults = async (opts: InstallOptions) => { allowNonAppliedPatches: false, autoInstallPeers: true, childConcurrency: 5, + confirmModulesPurge: opts.force, depth: 0, enablePnp: false, engineStrict: false, diff --git a/pkg-manager/get-context/src/index.ts b/pkg-manager/get-context/src/index.ts index cc0822ddb40..dcc737cfae9 100644 --- a/pkg-manager/get-context/src/index.ts +++ b/pkg-manager/get-context/src/index.ts @@ -72,6 +72,7 @@ interface HookOptions { export interface GetContextOptions { allProjects: Array + confirmModulesPurge?: boolean force: boolean forceNewModules?: boolean forceSharedLockfile: boolean @@ -116,7 +117,7 @@ export async function getContext ( registries: opts.registries, storeDir: opts.storeDir, virtualStoreDir, - confirmModulesPurge: !opts.force && !isCI, + confirmModulesPurge: opts.confirmModulesPurge && !isCI, forceHoistPattern: opts.forceHoistPattern, hoistPattern: opts.hoistPattern, @@ -408,6 +409,7 @@ export async function getContextForSingleImporter ( force: boolean forceNewModules?: boolean forceSharedLockfile: boolean + confirmModulesPurge?: boolean extraBinPaths: string[] extendNodePath?: boolean lockfileDir: string @@ -472,7 +474,7 @@ export async function getContextForSingleImporter ( registries: opts.registries, storeDir: opts.storeDir, virtualStoreDir, - confirmModulesPurge: !opts.force && !isCI, + confirmModulesPurge: opts.confirmModulesPurge && !isCI, forceHoistPattern: opts.forceHoistPattern, hoistPattern: opts.hoistPattern, diff --git a/pkg-manager/plugin-commands-installation/src/install.ts b/pkg-manager/plugin-commands-installation/src/install.ts index 04c9d1b0516..d9f51f4923e 100644 --- a/pkg-manager/plugin-commands-installation/src/install.ts +++ b/pkg-manager/plugin-commands-installation/src/install.ts @@ -305,6 +305,7 @@ export type InstallCommandOptions = Pick> export async function handler ( diff --git a/releasing/plugin-commands-deploy/src/deploy.ts b/releasing/plugin-commands-deploy/src/deploy.ts index 1e0755a3eb6..d813be29624 100644 --- a/releasing/plugin-commands-deploy/src/deploy.ts +++ b/releasing/plugin-commands-deploy/src/deploy.ts @@ -78,6 +78,7 @@ export async function handler ( await copyProject(deployedDir, deployDir, { includeOnlyPackageFiles }) await install.handler({ ...opts, + confirmModulesPurge: false, depth: Infinity, hooks: { ...opts.hooks,