|
| 1 | +# Patch Instructions |
| 2 | + |
| 3 | +This guide covers how to generate a patch file for your libraries. This is helpful in cases where you need to edit pod files, manifest files, etc. |
| 4 | + |
| 5 | +## How to Generate a Patch File |
| 6 | + |
| 7 | +### Step 1: Create a New Project |
| 8 | + |
| 9 | +Clone this repository, then create a new project with the following command: |
| 10 | + |
| 11 | +```sh |
| 12 | +npx @react-native-community/cli@latest init RNApp --version nightly --skip-install --directory tmp/RNApp |
| 13 | +``` |
| 14 | + |
| 15 | +### Step 2: Navigate to the Directory |
| 16 | + |
| 17 | +```sh |
| 18 | +cd tmp/RNApp |
| 19 | +``` |
| 20 | + |
| 21 | +### Step 3: Make Necessary Changes |
| 22 | + |
| 23 | +Make the necessary changes to the template. |
| 24 | + |
| 25 | +### Step 4: Generate the Patch File |
| 26 | + |
| 27 | +```sh |
| 28 | +node ../../scripts/make-patch.js ../../patches/{libraryName}.patch |
| 29 | +``` |
| 30 | + |
| 31 | +For example: |
| 32 | +```sh |
| 33 | +node ../../scripts/make-patch.js ../../patches/react-native-turbo-encryption.patch |
| 34 | +``` |
| 35 | + |
| 36 | +This will generate a patch file in the patches folder. |
| 37 | + |
| 38 | +**Note:** Remove any lock files like `yarn.lock`, `Podfile.lock`, or any generated files that are tracked before generating the patch file, as these can lead to an excessively long patch file. |
| 39 | + |
| 40 | +### Step 5: Verify the Patch File |
| 41 | + |
| 42 | +```sh |
| 43 | +node ../../scripts/apply-patch.js ../../patches/{libraryName}.patch |
| 44 | +``` |
| 45 | +For example: |
| 46 | +```sh |
| 47 | +node ../../scripts/apply-patch.js ../../patches/react-native-turbo-encryption.patch |
| 48 | +``` |
| 49 | + |
| 50 | + |
| 51 | +### Step 6: Add the Patch File to `libraries.json` |
| 52 | + |
| 53 | +```json |
| 54 | +"react-native-reanimated": { |
| 55 | + "description": "React Native's Animated library reimplemented", |
| 56 | + "installCommand": "react-native-reanimated@nightly react-native-worklets@nightly", |
| 57 | + "android": true, |
| 58 | + "ios": true, |
| 59 | + "maintainersUsernames": [], |
| 60 | + "notes": "", |
| 61 | + "patchFile": "patches/reanimated.patch" # <-- Path to patch file |
| 62 | + } |
| 63 | +``` |
| 64 | + |
| 65 | +### Step 7: Submit Your Changes |
| 66 | + |
| 67 | +Push the changes and create a pull request. Your patch file is ready! |
0 commit comments