Skip to content

Commit

Permalink
fix(deploy): always purge modules directory
Browse files Browse the repository at this point in the history
close #6510
  • Loading branch information
zkochan committed May 7, 2023
1 parent 5e0165c commit 4916a62
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg-manager/core/src/install/extendInstallOptions.ts
Expand Up @@ -123,6 +123,7 @@ export interface StrictInstallOptions {
dedupePeerDependents: boolean
extendNodePath: boolean
excludeLinksFromLockfile: boolean
confirmModulesPurge: boolean
}

export type InstallOptions =
Expand All @@ -139,6 +140,7 @@ const defaults = async (opts: InstallOptions) => {
allowNonAppliedPatches: false,
autoInstallPeers: true,
childConcurrency: 5,
confirmModulesPurge: opts.force,
depth: 0,
enablePnp: false,
engineStrict: false,
Expand Down
6 changes: 4 additions & 2 deletions pkg-manager/get-context/src/index.ts
Expand Up @@ -72,6 +72,7 @@ interface HookOptions {

export interface GetContextOptions {
allProjects: Array<ProjectOptions & HookOptions>
confirmModulesPurge?: boolean
force: boolean
forceNewModules?: boolean
forceSharedLockfile: boolean
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -408,6 +409,7 @@ export async function getContextForSingleImporter (
force: boolean
forceNewModules?: boolean
forceSharedLockfile: boolean
confirmModulesPurge?: boolean
extraBinPaths: string[]
extendNodePath?: boolean
lockfileDir: string
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions pkg-manager/plugin-commands-installation/src/install.ts
Expand Up @@ -305,6 +305,7 @@ export type InstallCommandOptions = Pick<Config,
saveLockfile?: boolean
workspace?: boolean
includeOnlyPackageFiles?: boolean
confirmModulesPurge?: boolean
} & Partial<Pick<Config, 'modulesCacheMaxAge' | 'pnpmHomeDir' | 'preferWorkspacePackages'>>

export async function handler (
Expand Down
1 change: 1 addition & 0 deletions releasing/plugin-commands-deploy/src/deploy.ts
Expand Up @@ -78,6 +78,7 @@ export async function handler (
await copyProject(deployedDir, deployDir, { includeOnlyPackageFiles })
await install.handler({
...opts,
confirmModulesPurge: false,
depth: Infinity,
hooks: {
...opts.hooks,
Expand Down

0 comments on commit 4916a62

Please sign in to comment.