-
Notifications
You must be signed in to change notification settings - Fork 462
feat(expo): Move Google Sign to a separate package #9015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d1c57d6
91717af
c95661f
3dd4a92
0a9bd17
a26f37a
7d44ed6
e51652a
01dae50
1af4841
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@clerk/expo': major | ||
| '@clerk/expo-google-signin': minor | ||
| --- | ||
|
|
||
| Move native Google Sign-In out of `@clerk/expo` and into `@clerk/expo-google-signin`. | ||
|
|
||
| Apps using native Google Sign-In should install `@clerk/expo-google-signin`, add it to the Expo config plugin list alongside `@clerk/expo`, and rebuild their native app. The `@clerk/expo/google` import path continues to re-export `useSignInWithGoogle`, but now requires `@clerk/expo-google-signin` to be installed. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| apply plugin: 'com.android.library' | ||
| apply plugin: 'kotlin-android' | ||
| apply plugin: 'maven-publish' | ||
|
|
||
| group = 'expo.modules.clerk.googlesignin' | ||
| version = '1.0.0' | ||
|
|
||
| def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") | ||
| apply from: expoModulesCorePlugin | ||
| applyKotlinExpoModulesCorePlugin() | ||
| useCoreDependencies() | ||
| useExpoPublishing() | ||
|
|
||
| buildscript { | ||
| ext.safeExtGet = { prop, fallback -> | ||
| rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
| } | ||
| } | ||
|
|
||
| android { | ||
| namespace "expo.modules.clerk.googlesignin" | ||
|
|
||
| compileSdkVersion safeExtGet("compileSdkVersion", 36) | ||
|
|
||
| defaultConfig { | ||
| minSdkVersion safeExtGet("minSdkVersion", 24) | ||
| targetSdkVersion safeExtGet("targetSdkVersion", 36) | ||
| versionCode 1 | ||
| versionName "1.0.0" | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation project(':expo-modules-core') | ||
| implementation "androidx.credentials:credentials:1.3.0" | ||
| implementation "androidx.credentials:credentials-play-services-auth:1.3.0" | ||
| implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1" | ||
| implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import type { ConfigPlugin } from '@expo/config-plugins'; | ||
|
|
||
| declare const withClerkExpoGoogleSignIn: ConfigPlugin; | ||
|
|
||
| export = withClerkExpoGoogleSignIn; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| const { withInfoPlist, createRunOncePlugin } = require('@expo/config-plugins'); | ||
| const pkg = require('./package.json'); | ||
|
|
||
| const withClerkExpoGoogleSignIn = config => { | ||
| const iosUrlScheme = | ||
| process.env.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME || | ||
| (config.extra && config.extra.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME); | ||
|
|
||
| if (!iosUrlScheme) { | ||
| return config; | ||
| } | ||
|
|
||
| return withInfoPlist(config, modConfig => { | ||
| if (!Array.isArray(modConfig.modResults.CFBundleURLTypes)) { | ||
| modConfig.modResults.CFBundleURLTypes = []; | ||
| } | ||
|
|
||
| const schemeExists = modConfig.modResults.CFBundleURLTypes.some(urlType => | ||
| urlType.CFBundleURLSchemes?.includes(iosUrlScheme), | ||
| ); | ||
|
|
||
| if (!schemeExists) { | ||
| modConfig.modResults.CFBundleURLTypes.push({ | ||
| CFBundleURLSchemes: [iosUrlScheme], | ||
| }); | ||
| } | ||
|
|
||
| return modConfig; | ||
| }); | ||
| }; | ||
|
|
||
| module.exports = createRunOncePlugin(withClerkExpoGoogleSignIn, pkg.name, pkg.version); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "platforms": ["apple", "android"], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the Expo native matrix exercise this package as part of the split? The current workflow still only triggers on
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah I think that's one way of testing it! will add |
||
| "apple": { | ||
| "modules": ["ClerkGoogleSignInModule"] | ||
| }, | ||
| "android": { | ||
| "modules": ["expo.modules.clerk.googlesignin.ClerkGoogleSignInModule"] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| { | ||
| "name": "@clerk/expo-google-signin", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we do anything for the first-publish path here, or is the plan to force this check once and publish immediately after merge?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question! We need a manual publish for a pre-release version so that pkg-pr-new can pick it up (it wants a package available on NPM already). @dominic-clerk similar to electron and electron-passkeys, can I request for
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wobsoriano Done! ✅
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Dominic! |
||
| "version": "0.0.0", | ||
| "description": "Native Google Sign-In library to be used with Clerk for Expo", | ||
| "keywords": [ | ||
| "react-native", | ||
| "expo", | ||
| "google-signin", | ||
| "clerk" | ||
| ], | ||
| "homepage": "https://clerk.com/", | ||
| "bugs": { | ||
| "url": "https://github.com/clerk/javascript/issues" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/clerk/javascript.git", | ||
| "directory": "packages/expo-google-signin" | ||
| }, | ||
| "license": "MIT", | ||
| "author": "Clerk", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "files": [ | ||
| "dist", | ||
| "android", | ||
| "ios", | ||
| "expo-module.config.json", | ||
| "app.plugin.js", | ||
| "app.plugin.d.ts" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "build:declarations": "tsc -p tsconfig.declarations.json", | ||
| "clean": "rimraf ./dist", | ||
| "dev": "tsup --watch", | ||
| "dev:pub": "pnpm dev -- --env.publish", | ||
| "format": "node ../../scripts/format-package.mjs", | ||
| "format:check": "node ../../scripts/format-package.mjs --check", | ||
| "lint": "eslint src", | ||
| "test": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@clerk/react": "workspace:^", | ||
| "@clerk/shared": "workspace:^", | ||
| "tslib": "catalog:repo" | ||
| }, | ||
| "devDependencies": { | ||
| "@expo/config-plugins": "^54.0.4", | ||
| "@types/react": "catalog:react", | ||
| "expo": "~54.0.34", | ||
| "expo-constants": "^18.0.13", | ||
| "expo-crypto": "^15.0.9", | ||
| "react": "catalog:react", | ||
| "react-native": "^0.85.2", | ||
| "tsup": "catalog:repo" | ||
| }, | ||
| "peerDependencies": { | ||
| "expo": ">=53 <57", | ||
| "expo-constants": ">=12", | ||
| "expo-crypto": ">=12", | ||
| "react": "^18.0.0 || ^19.0.0", | ||
| "react-native": ">=0.75" | ||
|
Comment on lines
+51
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🌐 Web query:
💡 Result: Expo SDK 54 requires React Native 0.81 [1][2]. It is not compatible with React Native 0.85 [3][4]. Each version of Expo SDK is designed to work with a specific React Native version, and using mismatched versions is generally not supported [3]. React Native 0.85 was introduced as the target version for Expo SDK 56 [3][4]. Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the package manifest and nearby workspace context.
sed -n '1,220p' packages/expo-google-signin/package.json
printf '\n---\n'
git ls-files 'packages/expo-google-signin/*' | sed -n '1,120p'Repository: clerk/javascript Length of output: 3499 Align the Expo devDependency versions. Expo SDK 54 ships with React Native 0.81, so 🤖 Prompt for AI Agents |
||
| }, | ||
| "peerDependenciesMeta": { | ||
| "expo-constants": { | ||
| "optional": true | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| declare const PACKAGE_NAME: string; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export { useSignInWithGoogle } from './useSignInWithGoogle'; | ||
| export type { | ||
| StartGoogleAuthenticationFlowParams, | ||
| StartGoogleAuthenticationFlowReturnType, | ||
| } from './useSignInWithGoogle.types'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import type { SetActive, SignInResource, SignUpResource } from '@clerk/shared/types'; | ||
|
|
||
| type SignUpUnsafeMetadata = Record<string, unknown>; | ||
|
|
||
| export type StartGoogleAuthenticationFlowParams = { | ||
| unsafeMetadata?: SignUpUnsafeMetadata; | ||
| }; | ||
|
Comment on lines
+3
to
7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Reuse the shared
🤖 Prompt for AI Agents |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "skipLibCheck": true, | ||
| "incremental": false, | ||
| "noEmit": false, | ||
| "declaration": true, | ||
| "emitDeclarationOnly": true, | ||
| "declarationMap": true, | ||
| "sourceMap": false, | ||
| "declarationDir": "./dist" | ||
| }, | ||
| "exclude": ["**/__tests__/**/*", "app.plugin.js"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "allowJs": true, | ||
| "declaration": true, | ||
| "declarationMap": false, | ||
| "esModuleInterop": true, | ||
| "importHelpers": true, | ||
| "incremental": true, | ||
| "jsx": "react-jsx", | ||
| "lib": ["ESNext", "dom"], | ||
| "module": "NodeNext", | ||
| "moduleResolution": "NodeNext", | ||
| "noEmitOnError": false, | ||
| "noImplicitReturns": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| "outDir": "dist", | ||
| "resolveJsonModule": true, | ||
| "skipLibCheck": true, | ||
| "sourceMap": false, | ||
| "strict": true, | ||
| "target": "ES2019", | ||
| "types": ["node"], | ||
| "rootDir": "./src" | ||
| }, | ||
| "include": ["src", "app.plugin.js"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add
@clerk/expo-google-signinto the API Changes/break-check coverage too?@clerk/expoand@clerk/expo-passkeysare already tracked there, so it seems like this new public package should get the same declaration snapshot coverage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I will add it