Skip to content

Commit

Permalink
1.0.0 (13)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Sep 20, 2024
1 parent a763aae commit e300e61
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DATABASE_URL=
supabaseUrl=
supabaseAnonKey=
expoProjectId=
EXPO_PUBLIC_SUPABASE_URL=
EXPO_PUBLIC_SUPABASE_ANON_KEY=
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=
4 changes: 2 additions & 2 deletions .github/workflows/deploy-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
20 changes: 1 addition & 19 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 0 additions & 2 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
9 changes: 7 additions & 2 deletions src/hooks/useSupabase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ 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<typeof createClient<Database>>;

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<Database>(supabaseUrl, supabaseAnonKey, {
console.log('supabaseUrl', supabaseUrl);
console.log('supabaseAnonKey', supabaseAnonKey);

return createClient<Database>(supabaseUrl!, supabaseAnonKey!, {
global: {
// Get the custom Supabase token from Clerk
fetch: async (url, options = {}) => {
Expand Down

0 comments on commit e300e61

Please sign in to comment.