Skip to content

Commit ec6dbe2

Browse files
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

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.19.1
1+
20.19.0

android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ buildscript {
1111
mavenCentral()
1212
}
1313
dependencies {
14-
classpath 'com.android.tools.build:gradle:8.6.0'
14+
classpath 'com.android.tools.build:gradle:8.7.2'
1515
}
1616
}
1717

1818
apply plugin: 'com.android.library'
1919

2020
android {
2121
namespace "com.frontegg.ionic"
22-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
22+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
2323
defaultConfig {
2424
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 26
25-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
25+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
2626
versionCode 1
2727
versionName "1.0"
2828
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -44,8 +44,8 @@ android {
4444
abortOnError false
4545
}
4646
compileOptions {
47-
sourceCompatibility JavaVersion.VERSION_17
48-
targetCompatibility JavaVersion.VERSION_17
47+
sourceCompatibility JavaVersion.VERSION_21
48+
targetCompatibility JavaVersion.VERSION_21
4949
}
5050
}
5151

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

example/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
"@angular/platform-browser": "^16.0.0",
2525
"@angular/platform-browser-dynamic": "^16.0.0",
2626
"@angular/router": "^16.0.0",
27-
"@capacitor/android": "5.2.1",
28-
"@capacitor/app": "5.0.6",
29-
"@capacitor/core": "5.2.1",
30-
"@capacitor/haptics": "5.0.6",
31-
"@capacitor/ios": "5.2.1",
32-
"@capacitor/keyboard": "5.0.6",
33-
"@capacitor/status-bar": "5.0.6",
27+
"@capacitor/android": "^7.0.0",
28+
"@capacitor/app": "^7.0.0",
29+
"@capacitor/core": "^7.0.0",
30+
"@capacitor/haptics": "^7.0.0",
31+
"@capacitor/ios": "^7.0.0",
32+
"@capacitor/keyboard": "^7.0.0",
33+
"@capacitor/status-bar": "^7.0.0",
3434
"@frontegg/ionic-capacitor": "file:..",
3535
"@frontegg/rest-api": "^7.0.0",
3636
"@ionic/angular": "^7.0.0",
@@ -50,7 +50,7 @@
5050
"@angular/compiler": "^16.0.0",
5151
"@angular/compiler-cli": "^16.0.0",
5252
"@angular/language-service": "^16.0.0",
53-
"@capacitor/cli": "5.2.1",
53+
"@capacitor/cli": "^7.0.0",
5454
"@ionic/angular-toolkit": "^9.0.0",
5555
"@types/jasmine": "~4.3.0",
5656
"@types/node": "^12.11.1",

0 commit comments

Comments
 (0)