mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-30 10:38:13 -05:00
fix: patch-remove command failed to remove path file (#9374)
This commit is contained in:
5
.changeset/pretty-pandas-hear.md
Normal file
5
.changeset/pretty-pandas-hear.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-patching": minor
|
||||
---
|
||||
|
||||
The pnpm `patch-remove` command failed to remove the corresponding patch file.
|
||||
@@ -5,7 +5,6 @@ import { writeSettings } from '@pnpm/config.config-writer'
|
||||
import { install } from '@pnpm/plugin-commands-installation'
|
||||
import { type Config, types as allTypes } from '@pnpm/config'
|
||||
import { PnpmError } from '@pnpm/error'
|
||||
import { type ProjectRootDir } from '@pnpm/types'
|
||||
import renderHelp from 'render-help'
|
||||
import { prompt } from 'enquirer'
|
||||
import pick from 'ramda/src/pick'
|
||||
@@ -32,7 +31,6 @@ export type PatchRemoveCommandOptions = install.InstallCommandOptions & Pick<Con
|
||||
|
||||
export async function handler (opts: PatchRemoveCommandOptions, params: string[]): Promise<void> {
|
||||
let patchesToRemove = params
|
||||
const lockfileDir = (opts.lockfileDir ?? opts.dir ?? process.cwd()) as ProjectRootDir
|
||||
const patchedDependencies = opts.patchedDependencies ?? {}
|
||||
|
||||
if (!params.length) {
|
||||
@@ -59,7 +57,7 @@ export async function handler (opts: PatchRemoveCommandOptions, params: string[]
|
||||
const patchesDirs = new Set<string>()
|
||||
await Promise.all(patchesToRemove.map(async (patch) => {
|
||||
if (Object.prototype.hasOwnProperty.call(patchedDependencies, patch)) {
|
||||
const patchFile = path.join(lockfileDir, patchedDependencies[patch])
|
||||
const patchFile = patchedDependencies[patch]
|
||||
patchesDirs.add(path.dirname(patchFile))
|
||||
await fs.rm(patchFile, { force: true })
|
||||
delete patchedDependencies![patch]
|
||||
|
||||
Reference in New Issue
Block a user