Skip to content

Implement multi-patch support in patch-package #20770

@roryabraham

Description

@roryabraham

Problem

patch-package is a simple and useful package that we use to implement bug fixes and new features in 3rd-party libraries without creating a fork. However, it's limited in that each package can have only one monolithic patch file. This makes it difficult to keep track of separate changes in a 3rd-party package, which is one of the reasons we've opted for forks in the past. You can track pull requests in the fork in parallel with their upstream equivalent and use that to reconcile all the custom changes we've made to a 3rd-party dependency. This also helps indicate when our code has landed upstream and the fork/patch is no longer needed.

Solution

Upgrade patch-package to support multiple patch files per dependency. To ground this with an example, let's say we wanted to patch an image bug in React Native, and also wanted to build a new feature in the TextInput component.

For each of these features, we could have a separate patch file for each patch, and those patches would be applied in sequence:

patches/react-native+0.72.0+ImageBug.patch
patches/react-native+0.72.0+TextInputFeature.patch

We could have a separate PR in E/App to introduce each of these patches, and those PRs would link to their upstream equivalent.

Furthermore, we should have error reporting on a per-patch basis, and a way to resolve conflicts in specific patches while upgrading the base version.

Additional context

Metadata

Metadata

Labels

DailyKSv2NewFeatureSomething to build that is a new item.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions