mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-13 19:16:21 -04:00
feat!: remove deprecated patch options (#10505)
* refactor: remove allowNonAppliedPatches * refactor: remove ignorePatchFailures * refactor: remove `strict` field in groupPatchedDependencies * test: update test failure in package patching * test: fix * docs: update changesets --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
committed by
Zoltan Kochan
parent
f8b4895e0a
commit
7b1c189f2e
@@ -108,7 +108,6 @@ export async function handler (opts: PatchCommandOptions, params: string[]): Pro
|
||||
|
||||
if (!opts.ignoreExisting && opts.patchedDependencies) {
|
||||
tryPatchWithExistingPatchFile({
|
||||
allowFailure: patchedDep.applyToAll,
|
||||
patchedDep,
|
||||
patchedDir: editDir,
|
||||
patchedDependencies: opts.patchedDependencies,
|
||||
@@ -129,13 +128,11 @@ To commit your changes, run:
|
||||
|
||||
function tryPatchWithExistingPatchFile (
|
||||
{
|
||||
allowFailure,
|
||||
patchedDep: { applyToAll, alias, bareSpecifier },
|
||||
patchedDir,
|
||||
patchedDependencies,
|
||||
lockfileDir,
|
||||
}: {
|
||||
allowFailure: boolean
|
||||
patchedDep: GetPatchedDependencyResult
|
||||
patchedDir: string
|
||||
patchedDependencies: Record<string, string>
|
||||
@@ -157,5 +154,5 @@ function tryPatchWithExistingPatchFile (
|
||||
if (!fs.existsSync(existingPatchFilePath)) {
|
||||
throw new PnpmError('PATCH_FILE_NOT_FOUND', `Unable to find patch file ${existingPatchFilePath}`)
|
||||
}
|
||||
applyPatchToDir({ patchedDir, patchFilePath: existingPatchFilePath, allowFailure })
|
||||
applyPatchToDir({ patchedDir, patchFilePath: existingPatchFilePath })
|
||||
}
|
||||
|
||||
@@ -849,9 +849,9 @@ describe('prompt to choose version', () => {
|
||||
expect(path.basename(patchDir)).toMatch(/^chalk@\d+\.\d+\.\d+$/)
|
||||
expect(fs.existsSync(patchDir)).toBe(true)
|
||||
expect(JSON.parse(fs.readFileSync(path.join(patchDir, 'package.json'), 'utf8')).version).toBe('5.3.0')
|
||||
expect(fs.existsSync(path.join(patchDir, 'source/index.js'))).toBe(true)
|
||||
expect(fs.existsSync(path.join(patchDir, 'license'))).toBe(true)
|
||||
|
||||
fs.appendFileSync(path.join(patchDir, 'source/index.js'), '// test patching', 'utf8')
|
||||
fs.appendFileSync(path.join(patchDir, 'license'), '\ntest patching', 'utf8')
|
||||
await patchCommit.handler({
|
||||
...DEFAULT_OPTS,
|
||||
cacheDir,
|
||||
@@ -868,8 +868,8 @@ describe('prompt to choose version', () => {
|
||||
})
|
||||
const patchContent = fs.readFileSync('patches/chalk.patch', 'utf8')
|
||||
expect(patchContent).toContain('diff --git')
|
||||
expect(patchContent).toContain('// test patching')
|
||||
expect(fs.readFileSync('node_modules/.pnpm/@pnpm.e2e+requires-chalk-530@1.0.0/node_modules/chalk/source/index.js', 'utf8')).toContain('// test patching')
|
||||
expect(patchContent).toContain('test patching')
|
||||
expect(fs.readFileSync('node_modules/.pnpm/@pnpm.e2e+requires-chalk-530@1.0.0/node_modules/chalk/license', 'utf8')).toContain('test patching')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user