mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 21:11:55 -04:00
fix(plugin-commands-patching): do not create empty patch directory (#7410)
This commit is contained in:
@@ -48,7 +48,6 @@ export async function handler (opts: install.InstallCommandOptions & Pick<Config
|
||||
const lockfileDir = opts.lockfileDir ?? opts.dir ?? process.cwd()
|
||||
const patchesDirName = normalizePath(path.normalize(opts.patchesDir ?? 'patches'))
|
||||
const patchesDir = path.join(lockfileDir, patchesDirName)
|
||||
await fs.promises.mkdir(patchesDir, { recursive: true })
|
||||
const patchedPkgManifest = await readPackageJsonFromDir(userDir)
|
||||
const pkgNameAndVersion = `${patchedPkgManifest.name}@${patchedPkgManifest.version}`
|
||||
const gitTarballUrl = await getGitTarballUrlFromLockfile({
|
||||
@@ -67,6 +66,7 @@ export async function handler (opts: install.InstallCommandOptions & Pick<Config
|
||||
if (!patchContent.length) {
|
||||
return `No changes were found to the following directory: ${userDir}`
|
||||
}
|
||||
await fs.promises.mkdir(patchesDir, { recursive: true })
|
||||
|
||||
const patchFileName = pkgNameAndVersion.replace('/', '__')
|
||||
await fs.promises.writeFile(path.join(patchesDir, `${patchFileName}.patch`), patchContent, 'utf8')
|
||||
|
||||
Reference in New Issue
Block a user