diff --git a/.changeset/expo-google-signin-package.md b/.changeset/expo-google-signin-package.md new file mode 100644 index 00000000000..3b60bf9a55a --- /dev/null +++ b/.changeset/expo-google-signin-package.md @@ -0,0 +1,24 @@ +--- +'@clerk/expo': major +'@clerk/expo-google-signin': minor +--- + +Native Google Sign-In has moved out of `@clerk/expo` into a new optional package, `@clerk/expo-google-signin`. Apps that don't use `useSignInWithGoogle` no longer pull in the native Google Sign-In dependencies during prebuild. + +If you use native Google Sign-In, install the new package: + +```sh +npx expo install @clerk/expo-google-signin +``` + +add its config plugin alongside `@clerk/expo` in your app config: + +```json +{ + "expo": { + "plugins": ["@clerk/expo", "@clerk/expo-google-signin"] + } +} +``` + +then rebuild your native app. The `@clerk/expo/google` import path still re-exports `useSignInWithGoogle`, but it now requires `@clerk/expo-google-signin` to be installed. diff --git a/.github/workflows/expo-native-build.yml b/.github/workflows/expo-native-build.yml index f7e1b879dd3..a725c649217 100644 --- a/.github/workflows/expo-native-build.yml +++ b/.github/workflows/expo-native-build.yml @@ -10,6 +10,7 @@ on: - 'integration/templates/expo-native/**' - 'integration/tests/expo-native/**' - 'packages/expo/**' + - 'packages/expo-google-signin/**' workflow_dispatch: permissions: @@ -74,11 +75,13 @@ jobs: - name: Install monorepo dependencies run: pnpm install --frozen-lockfile - - name: Build and pack @clerk/expo + - name: Build and pack Clerk packages run: | pnpm --filter @clerk/expo... build + pnpm --filter @clerk/expo-google-signin build mkdir -p "$SDK_PACK_DIR" pnpm --filter @clerk/expo pack --pack-destination "$SDK_PACK_DIR" + pnpm --filter @clerk/expo-google-signin pack --pack-destination "$SDK_PACK_DIR" - name: Install fixture dependencies working-directory: ${{ env.FIXTURE_DIR }} @@ -88,8 +91,10 @@ jobs: run: | cp "package.sdk-$EXPO_SDK.json" package.json pnpm install --no-frozen-lockfile - SDK_TARBALL="$(ls "$SDK_PACK_DIR"/clerk-expo-*.tgz)" - pnpm add "$SDK_TARBALL" -w + # [0-9] keeps this glob off the clerk-expo-google-signin tarball. + SDK_TARBALL="$(ls "$SDK_PACK_DIR"/clerk-expo-[0-9]*.tgz)" + GOOGLE_SIGNIN_TARBALL="$(ls "$SDK_PACK_DIR"/clerk-expo-google-signin-*.tgz)" + pnpm add "$SDK_TARBALL" "$GOOGLE_SIGNIN_TARBALL" -w # expo-dev-client makes even release builds boot into the dev # launcher (unreachable Metro in CI), which stalls every Maestro # flow on a blank screen. Skip it on e2e jobs only. diff --git a/break-check.config.json b/break-check.config.json index 44a7de9fa25..80dba83eb30 100644 --- a/break-check.config.json +++ b/break-check.config.json @@ -5,6 +5,7 @@ "packages/chrome-extension", "packages/clerk-js", "packages/expo", + "packages/expo-google-signin", "packages/expo-passkeys", "packages/express", "packages/fastify", diff --git a/integration/templates/expo-native/App.tsx b/integration/templates/expo-native/App.tsx index 1f824007263..2031e9b4512 100644 --- a/integration/templates/expo-native/App.tsx +++ b/integration/templates/expo-native/App.tsx @@ -1,4 +1,5 @@ import { ClerkProvider, useAuth, useUser } from '@clerk/expo'; +import { useSignInWithGoogle } from '@clerk/expo/google'; import { AuthView, UserButton } from '@clerk/expo/native'; import { tokenCache } from '@clerk/expo/token-cache'; import { useState } from 'react'; @@ -13,7 +14,9 @@ if (!publishableKey) { function NativeBuildFixture() { const { isLoaded, isSignedIn, signOut } = useAuth({ treatPendingAsSignedOut: false }); const { user } = useUser(); + const { startGoogleAuthenticationFlow } = useSignInWithGoogle(); const [isAuthOpen, setIsAuthOpen] = useState(false); + const [googleResult, setGoogleResult] = useState(null); return ( @@ -29,6 +32,19 @@ function NativeBuildFixture() { title='Open native AuthView' onPress={() => setIsAuthOpen(true)} /> + {!isSignedIn && ( +