@trainon-inc/capacitor-clerk-native 1.14.0 → 1.21.0
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 +108 -16
- package/android/build.gradle +57 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -32,15 +32,8 @@ This allows your Capacitor app to use Clerk's native iOS/Android SDKs (following
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
35
|
-
### From
|
|
35
|
+
### From npm (Recommended)
|
|
36
36
|
|
|
37
|
-
1. Create a `.npmrc` file in your project root:
|
|
38
|
-
```
|
|
39
|
-
@trainon-inc:registry=https://npm.pkg.github.com
|
|
40
|
-
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
2. Install the package:
|
|
44
37
|
```bash
|
|
45
38
|
npm install @trainon-inc/capacitor-clerk-native
|
|
46
39
|
# or
|
|
@@ -49,15 +42,23 @@ pnpm add @trainon-inc/capacitor-clerk-native
|
|
|
49
42
|
yarn add @trainon-inc/capacitor-clerk-native
|
|
50
43
|
```
|
|
51
44
|
|
|
52
|
-
|
|
45
|
+
### From GitHub Packages
|
|
53
46
|
|
|
54
|
-
|
|
47
|
+
Alternatively, install from GitHub Packages:
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
1. Create a `.npmrc` file in your project root:
|
|
50
|
+
```
|
|
51
|
+
@trainon-inc:registry=https://npm.pkg.github.com
|
|
52
|
+
//npm.pkg.github.com/:_authToken= YOUR_GITHUB_TOKEN
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. Install the package:
|
|
57
56
|
```bash
|
|
58
|
-
npm install capacitor-clerk-native
|
|
57
|
+
npm install @trainon-inc/capacitor-clerk-native
|
|
59
58
|
```
|
|
60
59
|
|
|
60
|
+
> **Note**: You'll need a GitHub Personal Access Token with `read:packages` permission. [Create one here](https://github.com/settings/tokens/new?scopes=read:packages)
|
|
61
|
+
|
|
61
62
|
## iOS Setup
|
|
62
63
|
|
|
63
64
|
### Prerequisites
|
|
@@ -315,6 +316,8 @@ function Profile() {
|
|
|
315
316
|
|
|
316
317
|
## Architecture
|
|
317
318
|
|
|
319
|
+
### iOS Architecture (Bridge Pattern)
|
|
320
|
+
|
|
318
321
|
```
|
|
319
322
|
┌─────────────────────────────────────────────────┐
|
|
320
323
|
│ JavaScript/React (Capacitor WebView) │
|
|
@@ -336,6 +339,22 @@ function Profile() {
|
|
|
336
339
|
└─────────────────────────────────────────────────┘
|
|
337
340
|
```
|
|
338
341
|
|
|
342
|
+
### Android Architecture
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
┌─────────────────────────────────────────────────┐
|
|
346
|
+
│ JavaScript/React (Capacitor WebView) │
|
|
347
|
+
│ - Uses capacitor-clerk-native hooks │
|
|
348
|
+
└─────────────────┬───────────────────────────────┘
|
|
349
|
+
│ Capacitor Bridge
|
|
350
|
+
┌─────────────────▼───────────────────────────────┐
|
|
351
|
+
│ ClerkNativePlugin (Gradle Module) │
|
|
352
|
+
│ - Android library module │
|
|
353
|
+
│ - Receives calls from JavaScript │
|
|
354
|
+
│ - Can integrate with Clerk Android SDK │
|
|
355
|
+
└─────────────────────────────────────────────────┘
|
|
356
|
+
```
|
|
357
|
+
|
|
339
358
|
## API
|
|
340
359
|
|
|
341
360
|
### Methods
|
|
@@ -393,9 +412,83 @@ function Profile() {
|
|
|
393
412
|
- 💬 [Clerk Discord Community](https://clerk.com/discord)
|
|
394
413
|
- 🐛 [Report Issues](https://github.com/TrainOn-Inc/capacitor-clerk-native/issues)
|
|
395
414
|
|
|
396
|
-
## Android
|
|
415
|
+
## Android Setup
|
|
416
|
+
|
|
417
|
+
Android is supported using the same bridge pattern as iOS. The plugin provides a stub implementation that you can extend with the Clerk Android SDK.
|
|
418
|
+
|
|
419
|
+
### Prerequisites
|
|
420
|
+
|
|
421
|
+
- ✅ A [Clerk account](https://dashboard.clerk.com/sign-up)
|
|
422
|
+
- ✅ A Clerk application set up in the dashboard
|
|
423
|
+
- ✅ Android Studio with Gradle 8.7+ and AGP 8.5+
|
|
424
|
+
|
|
425
|
+
### 1. Sync Capacitor
|
|
426
|
+
|
|
427
|
+
After installing the plugin, sync your Android project:
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
npx cap sync android
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
This will:
|
|
434
|
+
- Add the plugin to `capacitor.settings.gradle`
|
|
435
|
+
- Add the plugin dependency to `capacitor.build.gradle`
|
|
436
|
+
|
|
437
|
+
### 2. Plugin Structure
|
|
438
|
+
|
|
439
|
+
The plugin includes:
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
android/
|
|
443
|
+
├── build.gradle # Gradle build configuration
|
|
444
|
+
└── src/
|
|
445
|
+
└── main/
|
|
446
|
+
├── AndroidManifest.xml # Android manifest
|
|
447
|
+
└── java/
|
|
448
|
+
└── com/trainon/capacitor/clerk/
|
|
449
|
+
└── ClerkNativePlugin.java
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### 3. Gradle Configuration
|
|
453
|
+
|
|
454
|
+
The plugin uses these default configurations (which can be overridden by your app's `variables.gradle`):
|
|
455
|
+
|
|
456
|
+
| Property | Default | Description |
|
|
457
|
+
|----------|---------|-------------|
|
|
458
|
+
| `compileSdkVersion` | 35 | Android compile SDK |
|
|
459
|
+
| `minSdkVersion` | 23 | Minimum Android version |
|
|
460
|
+
| `targetSdkVersion` | 35 | Target Android version |
|
|
461
|
+
| `junitVersion` | 4.13.2 | JUnit test version |
|
|
462
|
+
|
|
463
|
+
### 4. Build Requirements
|
|
464
|
+
|
|
465
|
+
- **Gradle**: 8.11.1+
|
|
466
|
+
- **Android Gradle Plugin**: 8.7.2+
|
|
467
|
+
- **Java**: 21
|
|
468
|
+
|
|
469
|
+
These are configured in the plugin's `build.gradle` and are compatible with Capacitor 7.
|
|
470
|
+
|
|
471
|
+
### Troubleshooting Android
|
|
472
|
+
|
|
473
|
+
#### "No matching variant" error
|
|
474
|
+
```
|
|
475
|
+
Could not resolve project :trainon-inc-capacitor-clerk-native
|
|
476
|
+
No matching variant of project was found. No variants exist.
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Solution**: Ensure you have the latest version of the plugin (1.16.0+) which includes the required `build.gradle` and `AndroidManifest.xml` files. Run:
|
|
480
|
+
```bash
|
|
481
|
+
npm update @trainon-inc/capacitor-clerk-native
|
|
482
|
+
npx cap sync android
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
#### Gradle sync fails
|
|
486
|
+
- Clean the project: **Build → Clean Project**
|
|
487
|
+
- Invalidate caches: **File → Invalidate Caches / Restart**
|
|
488
|
+
- Delete `.gradle` folder and re-sync
|
|
397
489
|
|
|
398
|
-
|
|
490
|
+
#### AGP version mismatch
|
|
491
|
+
If you see AGP version conflicts, ensure your app's `build.gradle` uses AGP 8.5.0 or higher, matching the plugin's requirements.
|
|
399
492
|
|
|
400
493
|
## Contributing
|
|
401
494
|
|
|
@@ -411,7 +504,6 @@ Created by the TrainOn Team to solve CocoaPods ↔ SPM conflicts when integratin
|
|
|
411
504
|
|
|
412
505
|
## Support
|
|
413
506
|
|
|
414
|
-
- [GitHub Issues](https://github.com/
|
|
507
|
+
- [GitHub Issues](https://github.com/TrainOn-Inc/capacitor-clerk-native/issues)
|
|
415
508
|
- [Clerk Documentation](https://clerk.com/docs)
|
|
416
509
|
- [Capacitor Documentation](https://capacitorjs.com/docs)
|
|
417
|
-
# Test CI/CD for npm publishing
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "com.trainon.capacitor.clerk"
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
dependencies {
|
|
51
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
52
|
+
implementation project(':capacitor-android')
|
|
53
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
54
|
+
testImplementation "junit:junit:$junitVersion"
|
|
55
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
56
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainon-inc/capacitor-clerk-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Capacitor plugin for Clerk native authentication using bridge pattern to integrate Clerk iOS/Android SDKs with CocoaPods/Gradle",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"android/src/main/",
|
|
20
20
|
"android/build.gradle",
|
|
21
|
+
"android/src/main/AndroidManifest.xml",
|
|
21
22
|
"dist/",
|
|
22
23
|
"ios/Plugin/",
|
|
23
24
|
"TrainonIncCapacitorClerkNative.podspec",
|