Commit ec6dbe2
authored
chore(capacitor)!: upgrade to Capacitor 7 (FR-25949) (#96)
* chore(capacitor)!: upgrade to Capacitor 7 (FR-25949)
Modern Ionic apps are on Capacitor 7 and could not adopt this SDK while it was pinned to
Capacitor 5. Bump the peer dependency and complete the compatibility pass.
- package.json: @capacitor/{core,android,ios} + peerDependencies -> ^7.0.0; add @capacitor/cli
^7; @capacitor/docgen ^0.3.0; typescript ~5.4.5; rollup ^4.30.1; rimraf ^5.0.10. .nvmrc -> 20.
- src/definitions.ts: addListener now returns Promise<PluginListenerHandle> (Capacitor 6 removed
the combined Promise<...> & PluginListenerHandle return type) — the one breaking-API change that
surfaced building against @capacitor/core@7.
- Android: AGP 8.6.0 -> 8.7.2, Gradle 8.4 -> 8.11.1, compileSdk/targetSdk 34 -> 35, Java 17 -> 21.
- iOS podspec already targets iOS 14 (the Capacitor 7 minimum) — unchanged.
- example: @capacitor/* -> ^7.
Validated: plugin JS builds clean (tsc 5.4 + rollup 4). Native builds (iOS pod/xcodebuild,
Android gradle) and the example app were NOT built in this environment — see PR notes.
* fix(capacitor): pin TypeScript to 4.9 so eslint (CI Lint | Build) passes
The Capacitor 7 bump raised TypeScript to ~5.4.5, but @ionic/eslint-config@0.3 ships the eslint 7
era @typescript-eslint parser, which throws 'originalKeywordKind has been deprecated since v5.0.0'
on every .ts file under TypeScript 5 — failing the Lint | Build check with 32 parse errors.
TypeScript ~4.9.5 compiles @capacitor/core@7 cleanly (verified: npm run build) and is parseable by
the existing lint toolchain (verified: npm run eslint + prettier --check pass), avoiding a
disruptive eslint 8 / prettier 3 migration. Bumping TS to 5.x can follow when the lint stack is
upgraded to @ionic/eslint-config 0.4 / eslint 8.
* fix(capacitor): rename rollup config to .mjs so the build works on Node 18
rollup.config.js uses ESM (export default); with rollup 4 on the CI runner's Node 18, Node loads
it as CommonJS and throws 'Unexpected token export' (newer Node only warns). Rename to
rollup.config.mjs and point the build script at it (matches the Capacitor 7 plugin template).1 parent 1772f12 commit ec6dbe2
9 files changed
Lines changed: 7061 additions & 12970 deletions
File tree
- android
- gradle/wrapper
- example
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
0 commit comments