mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: properly check modules purge confirmation answer (#8655)
This commit is contained in:
6
.changeset/friendly-meals-kick.md
Normal file
6
.changeset/friendly-meals-kick.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/get-context": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Don't purge `node_modules`, when typing "n" in the prompt that asks whether to remove `node_modules` before installation [#8655](https://github.com/pnpm/pnpm/pull/8655).
|
||||
@@ -346,7 +346,7 @@ async function purgeModulesDirsOfImporters (
|
||||
importers: ImporterToPurge[]
|
||||
): Promise<void> {
|
||||
if (opts.confirmModulesPurge ?? true) {
|
||||
const confirmed = await enquirer.prompt({
|
||||
const confirmed = await enquirer.prompt<{ question: boolean }>({
|
||||
type: 'confirm',
|
||||
name: 'question',
|
||||
message: importers.length === 1
|
||||
@@ -354,7 +354,7 @@ async function purgeModulesDirsOfImporters (
|
||||
: 'The modules directories will be removed and reinstalled from scratch. Proceed?',
|
||||
initial: true,
|
||||
})
|
||||
if (!confirmed) {
|
||||
if (!confirmed.question) {
|
||||
throw new PnpmError('ABORTED_REMOVE_MODULES_DIR', 'Aborted removal of modules directory')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user