import dayjs from 'dayjs' import { DocsButton } from 'components/ui/DocsButton' import { InlineLink } from 'components/ui/InlineLink' import { useCLIReleaseVersionQuery } from 'data/misc/cli-release-version-query' import { Badge, Button, Dialog, DialogContent, DialogHeader, DialogSection, DialogTitle, DialogTrigger, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverSeparator_Shadcn_, PopoverTrigger_Shadcn_, SimpleCodeBlock, Tabs_Shadcn_, TabsContent_Shadcn_, TabsList_Shadcn_, TabsTrigger_Shadcn_, } from 'ui' import { Admonition } from 'ui-patterns' /** * TODO: Chat with Qiao how we can pass the CLI version into the env var for STUDIO_VERSION * Ideally we can also mark the beta version via STUDIO_VERSION too */ export const LocalVersionPopover = () => { const { data, isSuccess } = useCLIReleaseVersionQuery() const hasLatestCLIVersion = isSuccess && !!data?.latest const isLatestVersion = data?.current === data?.latest // [Joshen] This is just scaffolding - will need to figure out how to identify beta versions // We can do this separately const isBeta = false ///(data?.latest ?? '').includes('beta') const approximateNextRelease = !!data?.published_at ? dayjs(data?.published_at).utc().add(14, 'day').format('DD MMM YYYY') : undefined if (!isSuccess) return null return ( {isBeta ? 'Beta' : isLatestVersion ? 'Latest' : 'Update available'} {hasLatestCLIVersion ? ( !isBeta && !isLatestVersion ? (

A new version of Supabase CLI is available:

macOS Windows Linux npm / Bun brew upgrade supabase scoop upgrade supabase brew upgrade supabase npm update supabase --save-dev
) : (
{isBeta ? (

You're on the Beta version of Supabase CLI

) : (

You're on the latest version of Supabase CLI

)}
) ) : null}

All available release versions of the CLI can be found on our{' '} GitHub repository .

Stable release schedule

Approximate next release: {approximateNextRelease}

Supabase CLI releases follows a two-week schedule, with stable updates available through the{' '} CLI .

If you'd like to try, we recommend doing so via npm:

npm i supabase@beta --save-dev

Current version:

{data.current}

{hasLatestCLIVersion && !isLatestVersion && !isBeta && (

Available version:

{data.latest}

)}
) }