@capgo/capacitor-patch 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -143,6 +143,183 @@ The bundled catalog tracks external fix PRs mirrored by Capacitor+ auto-sync bra
|
|
|
143
143
|
|
|
144
144
|
Run `capgo-capacitor-patch list --all` to see the shipped catalog. Each entry includes the original upstream Capacitor PR URL, the Capacitor+ sync branch, target package, supported version range, and patch file.
|
|
145
145
|
|
|
146
|
+
## Future Automation
|
|
147
|
+
|
|
148
|
+
The long-term goal is to make this repository the fast path for Capacitor fixes that are waiting upstream.
|
|
149
|
+
|
|
150
|
+
For every external PR opened against `ionic-team/capacitor`, the automation should:
|
|
151
|
+
|
|
152
|
+
1. Detect whether the PR is a fix that changes shipped Capacitor code.
|
|
153
|
+
2. Wait until the upstream PR, or the matching Capacitor+ `sync/upstream-pr-*` branch, passes its test suite.
|
|
154
|
+
3. Generate package-ready patch files in this repository.
|
|
155
|
+
4. Open or update a pull request here with the new `patches/catalog.json` entries and patch files.
|
|
156
|
+
5. Run this repository's tests against supported Capacitor versions.
|
|
157
|
+
6. Comment on the original upstream PR with the quick-patch ID and install snippet once the patch package PR is ready.
|
|
158
|
+
|
|
159
|
+
The upstream PR comment should only be posted when the patch applies cleanly and this repository's checks pass. A good comment looks like:
|
|
160
|
+
|
|
161
|
+
````md
|
|
162
|
+
This fix is available as a quick patch through `@capgo/capacitor-patch`.
|
|
163
|
+
|
|
164
|
+
Patch ID: `upstream-pr-8418-android`
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
plugins: {
|
|
168
|
+
CapacitorPatch: {
|
|
169
|
+
patches: ['upstream-pr-8418-android'],
|
|
170
|
+
strict: true,
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Run `npx cap sync` after installing `@capgo/capacitor-patch`.
|
|
176
|
+
````
|
|
177
|
+
|
|
178
|
+
When a fix is merged and released upstream, the catalog entry should either narrow its version range to the affected releases or be removed in the next major catalog cleanup.
|
|
179
|
+
|
|
180
|
+
## Contributing Patches
|
|
181
|
+
|
|
182
|
+
Patch contributions should be small, traceable, and easy to remove once upstream ships the fix.
|
|
183
|
+
|
|
184
|
+
### Good patch candidates
|
|
185
|
+
|
|
186
|
+
- Fixes from external Capacitor PRs that are not merged or not released yet.
|
|
187
|
+
- Fixes mirrored by Capacitor+ `sync/upstream-pr-*` branches.
|
|
188
|
+
- Small bug fixes for `@capacitor/core`, `@capacitor/android`, `@capacitor/ios`, `@capacitor/cli`, Capacitor plugins, or generated native project files.
|
|
189
|
+
- Changes that can be expressed as a unified diff and safely version-gated.
|
|
190
|
+
|
|
191
|
+
Avoid broad refactors, formatting-only changes, feature work, generated lockfile changes, test-only changes, and patches that require app-specific assumptions.
|
|
192
|
+
|
|
193
|
+
### Patch file rules
|
|
194
|
+
|
|
195
|
+
Patch files live in `patches/` and must be unified diffs.
|
|
196
|
+
|
|
197
|
+
Use this naming pattern:
|
|
198
|
+
|
|
199
|
+
```text
|
|
200
|
+
patches/upstream-pr-<number>-<target>.patch
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Examples:
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
patches/upstream-pr-8418-android.patch
|
|
207
|
+
patches/upstream-pr-8304-ios.patch
|
|
208
|
+
patches/upstream-pr-8271-core.patch
|
|
209
|
+
patches/upstream-pr-8458-cli.patch
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
For package patches, paths are relative to the installed npm package root:
|
|
213
|
+
|
|
214
|
+
| Target package | Patch paths look like |
|
|
215
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
216
|
+
| `@capacitor/android` | `capacitor/src/main/java/com/getcapacitor/Bridge.java` |
|
|
217
|
+
| `@capacitor/ios` | `Capacitor/Capacitor/Router.swift` |
|
|
218
|
+
| `@capacitor/core` | `dist/index.js`, `dist/index.cjs.js` |
|
|
219
|
+
| `@capacitor/cli` | `dist/ios/update.js`, `dist/tasks/update.js` |
|
|
220
|
+
| Native bridge assets | `capacitor/src/main/assets/native-bridge.js` on Android or `Capacitor/Capacitor/assets/native-bridge.js` on iOS |
|
|
221
|
+
|
|
222
|
+
For native project patches, use `"phase": "native"` and make paths relative to the app root, such as `android/app/build.gradle` or `ios/App/App/Info.plist`.
|
|
223
|
+
|
|
224
|
+
Capacitor packages usually ship compiled JavaScript, not TypeScript source. If the upstream fix touches CLI or core TypeScript files, patch the shipped `dist/` JavaScript files that users actually have in `node_modules`.
|
|
225
|
+
|
|
226
|
+
### Catalog entry rules
|
|
227
|
+
|
|
228
|
+
Every patch needs an entry in `patches/catalog.json`.
|
|
229
|
+
|
|
230
|
+
Use stable IDs:
|
|
231
|
+
|
|
232
|
+
```text
|
|
233
|
+
upstream-pr-<number>-android
|
|
234
|
+
upstream-pr-<number>-ios
|
|
235
|
+
upstream-pr-<number>-core
|
|
236
|
+
upstream-pr-<number>-cli
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Use separate entries when one upstream PR patches multiple packages. For example, a fix that changes both Android and iOS should create `upstream-pr-6991-android` and `upstream-pr-6991-ios`.
|
|
240
|
+
|
|
241
|
+
Recommended shape:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"id": "upstream-pr-8418-android",
|
|
246
|
+
"title": "fix(android): range request truncation (android)",
|
|
247
|
+
"recommended": false,
|
|
248
|
+
"phase": "package",
|
|
249
|
+
"target": {
|
|
250
|
+
"type": "package",
|
|
251
|
+
"packageName": "@capacitor/android",
|
|
252
|
+
"versionRange": ">=8.3.2 <9.0.0"
|
|
253
|
+
},
|
|
254
|
+
"source": {
|
|
255
|
+
"upstreamPullRequest": "https://github.com/ionic-team/capacitor/pull/8418",
|
|
256
|
+
"capacitorPlusBranch": "https://github.com/Cap-go/capacitor-plus/tree/sync/upstream-pr-8418",
|
|
257
|
+
"author": "upstream-author",
|
|
258
|
+
"authorAssociation": "external"
|
|
259
|
+
},
|
|
260
|
+
"upstream": {
|
|
261
|
+
"state": "open",
|
|
262
|
+
"mergedAt": null,
|
|
263
|
+
"status": "not-merged-as-of-2026-05-12"
|
|
264
|
+
},
|
|
265
|
+
"patchFile": "patches/upstream-pr-8418-android.patch"
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Set `recommended: false` by default. Only set `recommended: true` when Capgo is comfortable applying the fix automatically after a user opts into recommended patches.
|
|
270
|
+
|
|
271
|
+
Use `supersedes` when a newer patch includes or replaces an older overlapping patch:
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"id": "upstream-pr-8429-android",
|
|
276
|
+
"supersedes": ["upstream-pr-7781-android"]
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Version ranges
|
|
281
|
+
|
|
282
|
+
Start with the narrowest range you have verified. Do not use `>=8.0.0 <9.0.0` unless the patch applies cleanly across the supported Capacitor 8 releases.
|
|
283
|
+
|
|
284
|
+
If a patch is already released upstream in later Capacitor versions, cap the upper bound:
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
"versionRange": ">=8.0.0 <8.3.1"
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Incompatible selected patches are skipped by default and fail when users set `strict: true`, so accurate version ranges are part of the user experience.
|
|
291
|
+
|
|
292
|
+
### Local validation
|
|
293
|
+
|
|
294
|
+
Before opening a patch PR, run:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
npm run lint
|
|
298
|
+
npm run verify
|
|
299
|
+
npm pack --dry-run
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Then test the patch against a throwaway app with the target Capacitor version:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
npm init -y
|
|
306
|
+
npm install @capgo/capacitor-patch @capacitor/android@8.3.3 @capacitor/ios@8.3.3 @capacitor/core@8.3.3 @capacitor/cli@8.3.3
|
|
307
|
+
CAPACITOR_CONFIG='{"plugins":{"CapacitorPatch":{"patches":["upstream-pr-8418-android"],"strict":true}}}' npx capgo-capacitor-patch doctor --root . --phase package
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
For an unpublished local branch, run the local binary from this repository and pass a config that selects the patch ID:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
CAPACITOR_CONFIG='{"plugins":{"CapacitorPatch":{"patches":["upstream-pr-8418-android"],"strict":true}}}' node /path/to/capacitor-patch/bin/capgo-capacitor-patch doctor --root . --phase package
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
The patch is ready when:
|
|
317
|
+
|
|
318
|
+
- `doctor` says the patch would apply for supported versions.
|
|
319
|
+
- Running `apply` twice reports `already-applied` on the second run.
|
|
320
|
+
- Incompatible versions skip cleanly or fail only in `strict: true`.
|
|
321
|
+
- `npm pack --dry-run` includes the catalog entry and patch file.
|
|
322
|
+
|
|
146
323
|
## Compatibility
|
|
147
324
|
|
|
148
325
|
| Plugin version | Capacitor compatibility | Maintained |
|
|
@@ -154,10 +331,10 @@ Run `capgo-capacitor-patch list --all` to see the shipped catalog. Each entry in
|
|
|
154
331
|
## Development
|
|
155
332
|
|
|
156
333
|
```bash
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
334
|
+
npm install
|
|
335
|
+
npm run build
|
|
336
|
+
npm run test
|
|
337
|
+
npm run lint
|
|
161
338
|
```
|
|
162
339
|
|
|
163
|
-
Use `
|
|
340
|
+
Use `npm run verify` before opening a pull request.
|
package/package.json
CHANGED