style(supabase): prettier pass on the new TypeScript files
This commit is contained in:
1 parent
d239374d81
commit
ab04b2e43d
9 files changed
+70
-27
No files matched your search
@@ -54,17 +54,29 @@ export function resolveSupabaseConnection(
|
||||
const cleanKey = nonEmpty(anonKey)
|
||||
if (cleanUrl && cleanKey) return { url: cleanUrl, anonKey: cleanKey }
|
||||
if ((cleanUrl || cleanKey) && import.meta.env.DEV) {
|
||||
console.warn('[config] supabaseUrl and supabaseAnonKey must be set together; Supabase disabled')
|
||||
console.warn(
|
||||
'[config] supabaseUrl and supabaseAnonKey must be set together; Supabase disabled',
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export function resolveConfig(runtime: RuntimeConfig = {}): AppConfig {
|
||||
return {
|
||||
siteName: runtime.siteName ?? import.meta.env.VITE_APP_SITE_NAME ?? DEFAULTS.siteName,
|
||||
brandName: runtime.brandName ?? import.meta.env.VITE_APP_BRAND_NAME ?? DEFAULTS.brandName,
|
||||
footerName: runtime.footerName ?? import.meta.env.VITE_APP_FOOTER_NAME ?? DEFAULTS.footerName,
|
||||
tagline: runtime.tagline ?? import.meta.env.VITE_APP_TAGLINE ?? DEFAULTS.tagline,
|
||||
siteName:
|
||||
runtime.siteName ??
|
||||
import.meta.env.VITE_APP_SITE_NAME ??
|
||||
DEFAULTS.siteName,
|
||||
brandName:
|
||||
runtime.brandName ??
|
||||
import.meta.env.VITE_APP_BRAND_NAME ??
|
||||
DEFAULTS.brandName,
|
||||
footerName:
|
||||
runtime.footerName ??
|
||||
import.meta.env.VITE_APP_FOOTER_NAME ??
|
||||
DEFAULTS.footerName,
|
||||
tagline:
|
||||
runtime.tagline ?? import.meta.env.VITE_APP_TAGLINE ?? DEFAULTS.tagline,
|
||||
supabase: resolveSupabaseConnection(
|
||||
runtime.supabaseUrl ?? import.meta.env.VITE_SUPABASE_URL,
|
||||
runtime.supabaseAnonKey ?? import.meta.env.VITE_SUPABASE_ANON_KEY,
|
||||
|
||||
@@ -8,7 +8,9 @@ let cached: { connectionUrl: string; client: FaunosteoClient } | null = null
|
||||
* configured. Callers must handle null: the current local-only flows do not
|
||||
* depend on Supabase. No UI uses this yet (foundation step).
|
||||
*/
|
||||
export function getSupabaseClient(config: AppConfig = appConfig): FaunosteoClient | null {
|
||||
export function getSupabaseClient(
|
||||
config: AppConfig = appConfig,
|
||||
): FaunosteoClient | null {
|
||||
if (!config.supabase) return null
|
||||
if (cached?.connectionUrl !== config.supabase.url) {
|
||||
cached = {
|
||||
|
||||
@@ -13,7 +13,10 @@ describe('resolveConfig', () => {
|
||||
supabaseUrl: 'http://127.0.0.1:54321',
|
||||
supabaseAnonKey: 'anon',
|
||||
})
|
||||
expect(config.supabase).toEqual({ url: 'http://127.0.0.1:54321', anonKey: 'anon' })
|
||||
expect(config.supabase).toEqual({
|
||||
url: 'http://127.0.0.1:54321',
|
||||
anonKey: 'anon',
|
||||
})
|
||||
})
|
||||
|
||||
it('still resolves identity strings injected at runtime', () => {
|
||||
|
||||
Reference in new issue
Block a user