fix(patch): error message for missing .modules.yaml (#8315)

close #8257
This commit is contained in:
Khải
2024-07-16 22:46:12 +07:00
committed by GitHub
parent f6e7ace2a2
commit 726753f05d
2 changed files with 10 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-patching": patch
"pnpm": patch
---
Correct the error message when trying to run `pnpm patch` without `node_modules/.modules.yaml` [#8257](https://github.com/pnpm/pnpm/issues/8257).

View File

@@ -4,7 +4,6 @@ import { prompt } from 'enquirer'
import { readCurrentLockfile, type TarballResolution } from '@pnpm/lockfile-file'
import { nameVerFromPkgSnapshot } from '@pnpm/lockfile-utils'
import { PnpmError } from '@pnpm/error'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import { readModulesManifest } from '@pnpm/modules-yaml'
import { isGitHostedPkgUrl } from '@pnpm/pick-fetcher'
import realpathMissing from 'realpath-missing'
@@ -76,7 +75,10 @@ export async function getVersionsFromLockfile (dep: ParseWantedDependencyResult,
if (!lockfile) {
throw new PnpmError(
'PATCH_NO_LOCKFILE',
`No ${WANTED_LOCKFILE} found: Cannot patch without a lockfile`
'The modules directory is not ready for patching',
{
hint: 'Run pnpm install first',
}
)
}