From 09cdb7f01d6565a801d69ef9753161b2283b5b00 Mon Sep 17 00:00:00 2001 From: hyochan Date: Fri, 20 Sep 2024 18:51:59 +0900 Subject: [PATCH] 1.0.0 (13) --- .env.sample | 4 ++-- .github/workflows/deploy-pr.yml | 4 ++-- .github/workflows/deploy.yml | 4 ++-- app.config.ts | 20 +------------------- bun.lockb | Bin 1018592 -> 1018592 bytes config.ts | 2 -- package.json | 4 ++-- src/hooks/useSupabase.tsx | 6 ++++-- 8 files changed, 13 insertions(+), 31 deletions(-) diff --git a/.env.sample b/.env.sample index 7ac7d11..797a524 100644 --- a/.env.sample +++ b/.env.sample @@ -1,5 +1,5 @@ DATABASE_URL= -supabaseUrl= -supabaseAnonKey= expoProjectId= +EXPO_PUBLIC_SUPABASE_URL= +EXPO_PUBLIC_SUPABASE_ANON_KEY= EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY= diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index b0aa4cb..e723741 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -29,8 +29,8 @@ jobs: - name: Build web run: bun build:web env: - supabaseUrl: ${{ secrets.supabaseUrl }} - supabaseAnonKey: ${{ secrets.supabaseAnonKey }} + supabaseUrl: ${{ secrets.EXPO_PUBLIC_SUPABSE_URL }} + supabaseAnonKey: ${{ secrets.EXPO_PUBLIC_SUPABSE_ANON_KEY }} EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY }} expoProjectId: ${{ secrets.expoProjectId }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1c49032..75b1eb5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,8 +27,8 @@ jobs: - name: Build web run: bun build:web env: - supabaseUrl: ${{ secrets.supabaseUrl }} - supabaseAnonKey: ${{ secrets.supabaseAnonKey }} + supabaseUrl: ${{ secrets.EXPO_PUBLIC_SUPABSE_URL }} + supabaseAnonKey: ${{ secrets.EXPO_PUBLIC_SUPABSE_ANON_KEY }} EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY }} expoProjectId: ${{ secrets.expoProjectId }} diff --git a/app.config.ts b/app.config.ts index 58be48d..4af27de 100644 --- a/app.config.ts +++ b/app.config.ts @@ -2,27 +2,11 @@ import 'dotenv/config'; import type {ConfigContext, ExpoConfig} from '@expo/config'; import withAndroidLocalizedName from '@mmomtchev/expo-android-localized-app-name'; -import dotenv from 'dotenv'; -import {expand} from 'dotenv-expand'; -import path from 'path'; import {version} from './package.json'; -// https://github.com/expo/expo/issues/23727#issuecomment-1651609858 -if (process.env.STAGE) { - expand( - dotenv.config({ - path: path.join( - __dirname, - ['./.env', process.env.STAGE].filter(Boolean).join('.'), - ), - override: true, - }), - ); -} - const DEEP_LINK_URL = '[firebaseAppId].web.app'; -const buildNumber = 12; +const buildNumber = 13; export default ({config}: ConfigContext): ExpoConfig => ({ ...config, @@ -79,8 +63,6 @@ export default ({config}: ConfigContext): ExpoConfig => ({ backgroundColor: '#343434', }, extra: { - supabaseUrl: process.env.supabaseUrl, - supabaseAnonKey: process.env.supabaseAnonKey, eas: {projectId: '1a0107b0-1cef-4913-875f-639c38f59101'}, }, updates: { diff --git a/bun.lockb b/bun.lockb index 0ed9231af09623b7f9fcb6d031e46ba5ad998671..26f8476256996c37844654abf4d2f0a4dec64d40 100755 GIT binary patch delta 64 zcmaDb)$YMmyM`9V7N!>F7M2#)7Pc1l7LFFqEnKOA9E@=WdPaK27VWu#TtLhX#5_RE N3&ecea|8K{Edjc!6oCK$ delta 63 zcmaDb)$YMmyM`9V7N!>F7M2#)7Pc1l7LFFqEnKOAOiT>ZAGULgx7P)70Wmia^8hg~ N5c6%X3*=9-1OUeO6>9(h diff --git a/config.ts b/config.ts index 02c10b7..34ebcf8 100644 --- a/config.ts +++ b/config.ts @@ -2,6 +2,4 @@ import Constants from 'expo-constants'; const extra = Constants?.expoConfig?.extra; -export const supabaseUrl = extra?.supabaseUrl; -export const supabaseAnonKey = extra?.supabaseAnonKey; export const expoProjectId = extra?.eas?.projectId; diff --git a/package.json b/package.json index c73dd8e..a4a7af3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "expo-router/entry", "scripts": { "start": "expo start", - "start:prod": "STAGE=prod expo start", + "start:prod": "dotenv -e .env.production -- expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", @@ -17,7 +17,7 @@ "test": "jest --runInBand", "ios:release": "dotenv -e .env -- expo run:ios --configuration Release", "android:release": "dotenv -e .env -- expo run:android --variant release", - "android:device:release": "STAGE=production react-native run-android --mode='release'", + "android:device:release": "dotenv -e .env.production -- react-native run-android --mode='release'", "eas:dev:updates": "dotenv -e .env -- eas update --branch development", "eas:preview:android": "dotenv -e .env.production -- eas build --profile preview --platform android", "eas:prod:updates": "dotenv -e .env.production -- eas update --branch production", diff --git a/src/hooks/useSupabase.tsx b/src/hooks/useSupabase.tsx index 59a56f3..2649b9f 100644 --- a/src/hooks/useSupabase.tsx +++ b/src/hooks/useSupabase.tsx @@ -2,19 +2,21 @@ import {useSession} from '@clerk/clerk-expo'; import {createClient} from '@supabase/supabase-js'; import {useEffect, useState} from 'react'; import {Database} from '../types/supabase'; -import {supabaseAnonKey, supabaseUrl} from '../../config'; import {ActiveSessionResource} from '@clerk/types'; import {useSetRecoilState} from 'recoil'; import {authRecoilState} from '../recoil/atoms'; export type SupabaseClient = ReturnType>; +const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL; +const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY; + function createClerkSupabaseClient( session?: ActiveSessionResource | null, ): SupabaseClient | null { if (!session) return null; - return createClient(supabaseUrl, supabaseAnonKey, { + return createClient(supabaseUrl!, supabaseAnonKey!, { global: { // Get the custom Supabase token from Clerk fetch: async (url, options = {}) => {