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 { DOCS_URL } from 'lib/constants' 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' import { getSemver, semverGte, semverLte } from './LocalVersionPopover.utils' export const LocalVersionPopover = () => { const { data, isSuccess } = useCLIReleaseVersionQuery() const currentCliVersion = data?.current const latestCliVersion = data?.latest const hasLatestCLIVersion = isSuccess && !!latestCliVersion const current = getSemver(currentCliVersion) const latest = getSemver(latestCliVersion) const hasUpdate = !!current && !!latest ? currentCliVersion !== latestCliVersion && semverLte(current, latest) : false const isBeta = !!current && !!latest && currentCliVersion !== latestCliVersion && semverGte(current, latest) const approximateNextRelease = !!data?.published_at ? dayjs(data?.published_at).utc().add(14, 'day').format('DD MMM YYYY') : undefined if (!isSuccess || !currentCliVersion) return null return ( {isBeta ? 'Beta' : hasUpdate ? 'Update available' : 'Latest'} {hasLatestCLIVersion ? ( !isBeta && hasUpdate ? (

A new version of Supabase CLI is available:

macOS Windows Linux npm / Bun brew upgrade supabase scoop update 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
{

Latest Beta version: {data.beta}

}

Current version:

{currentCliVersion}

{hasLatestCLIVersion && hasUpdate && !isBeta && (

Available version:

{latestCliVersion}

)}
) }