diff --git a/packages/core/utils/supabase/connectProject.ts b/packages/core/utils/supabase/connectProject.ts index 7645cc1..cb62ca0 100644 --- a/packages/core/utils/supabase/connectProject.ts +++ b/packages/core/utils/supabase/connectProject.ts @@ -21,11 +21,13 @@ export const connectSupabaseProject = async (projectName: string, currentDir: st const newProject = projects.find((project) => project.name === projectName); console.log('🖇️ Getting Supabase project keys...'); - const projectAPIKeys = execSync(`supabase projects api-keys --project-ref ${newProject?.id}`, { encoding: 'utf-8' }); + const projectAPIKeys = execSync(`supabase projects api-keys --project-ref ${newProject?.refId}`, { + encoding: 'utf-8', + }); const SUPABASE_ANON_KEY = getSupabaseKeys(projectAPIKeys).anonKey; const SUPABASE_SERVICE_ROLE_KEY = getSupabaseKeys(projectAPIKeys).serviceRoleKey; - const SUPABASE_URL = `https://${newProject?.id}.supabase.co/`; + const SUPABASE_URL = `https://${newProject?.refId}.supabase.co/`; console.log(`🖇️ Saving keys to .env...`); await updateEnvFile({ @@ -39,7 +41,7 @@ export const connectSupabaseProject = async (projectName: string, currentDir: st }); console.log('🖇️ Linking Supabase project...'); - execSync(`supabase projects link ${newProject?.id}`, { + execSync(`supabase link --project-ref ${newProject?.refId}`, { stdio: 'inherit', }); @@ -49,7 +51,7 @@ export const connectSupabaseProject = async (projectName: string, currentDir: st await continueOnAnyKeypress('🖇️ When you are ready to be redirected to the Supabase page press any key'); - execSync(`open https://supabase.com/dashboard/project/${newProject?.id}/settings/integrations`); + execSync(`open https://supabase.com/dashboard/project/${newProject?.refId}/settings/integrations`); const { isIntegrationReady } = await inquirer.prompt([ { @@ -64,7 +66,7 @@ export const connectSupabaseProject = async (projectName: string, currentDir: st // Uncomment after CLI progress task is done. // console.log("🖇️ Run \x1b[36mcreate-stapler-app\x1b[0m again when you've completed the integration."); console.log( - `🖇️ You can access your project dashboard at: https://supabase.com/dashboard/project/${newProject?.id}/settings/integrations`, + `🖇️ You can access your project dashboard at: https://supabase.com/dashboard/project/${newProject?.refId}/settings/integrations`, ); } }; diff --git a/packages/core/utils/supabase/utils/index.ts b/packages/core/utils/supabase/utils/index.ts index 6b212e1..2d23255 100644 --- a/packages/core/utils/supabase/utils/index.ts +++ b/packages/core/utils/supabase/utils/index.ts @@ -1,7 +1,7 @@ interface SupabaseProjectInfo { linked: boolean; org_id: string; - id: string; + refId: string; name: string; region: string; created_at: string; @@ -12,11 +12,11 @@ export function parseProjectsList(output: string): SupabaseProjectInfo[] { lines.splice(0, 2); return lines.map((line) => { - const [linked, org_id, id, name, region, created_at] = line.split('│').map((item) => item.trim()); + const [linked, org_id, refId, name, region, created_at] = line.split('│').map((item) => item.trim()); return { linked: linked !== '', org_id, - id, + refId, name, region, created_at,