diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts index f337efe5afe..b798ce5c99f 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts @@ -468,7 +468,7 @@ export const reference = { items: [ { name: 'Supabase CLI', - url: '/new/reference/cli', + url: '/new/reference/cli/start', items: [], icon: '/img/icons/javascript.svg', }, @@ -503,6 +503,26 @@ export const reference_javascript = { ], } +export const reference_cli = { + icon: '/img/icons/javascript-icon.svg', + title: 'javascript-js', + parent: '/reference', + items: [ + { + name: 'Getting Started', + items: [ + { + name: 'fake link', + href: '/reference/javascript/start', + level: 'reference_javascript', + items: [], + icon: '/img/icons/javascript.svg', + }, + ], + }, + ], +} + // export const reference: [ // { // label: 'Official' diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx index 0a63f7f4f9b..638cd23189d 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx @@ -53,6 +53,9 @@ const SideNav = () => { case url.includes(`/docs/new/reference/javascript/`) && url: setLevel('reference_javascript') break + case url.includes(`/docs/new/reference/cli/`) && url: + setLevel('reference_cli') + break default: break @@ -252,6 +255,7 @@ const SideNav = () => { {/* reference level */} + {/* // ref menu */} {/*
= (props) => { + const [open, setOpen] = useState(false) + return ( +
+ +
+ {props.children} +
+
+ ) +} + +type IOption = AcceptedValue | any + +const Option: FC = (props) => { + return ( +
+
+ + {props.name ?? 'no-name'} + + + {props.isOptional ? ( +
Optional
+ ) : ( +
+ REQUIRED +
+ )} +
+ {props.type ?? 'no type'} +
+

{props.description ?? 'nodescription'}

+
+ ) +} + +// @ts-ignore +Options.Option = Option + +export default Options diff --git a/apps/docs/components/Params.tsx b/apps/docs/components/Params.tsx new file mode 100644 index 00000000000..7475d4ab2de --- /dev/null +++ b/apps/docs/components/Params.tsx @@ -0,0 +1,30 @@ +import { FC } from 'react' +import { Flag } from '~/pages/new/reference/cli/[...slug]' + +type IParamProps = Flag | any + +const Param: FC = (paramItem) => { + return ( +
+
+ + {paramItem.name ?? 'no-name'} + + + {paramItem.isOptional ? ( +
Optional
+ ) : ( +
+ REQUIRED +
+ )} +
+ {paramItem.type ?? 'no type'} +
+

{paramItem.description ?? 'nodescription'}

+ {paramItem.children} +
+ ) +} + +export default Param diff --git a/apps/docs/pages/new/reference/cli/usage.tsx b/apps/docs/pages/new/reference/cli/[...slug].tsx similarity index 55% rename from apps/docs/pages/new/reference/cli/usage.tsx rename to apps/docs/pages/new/reference/cli/[...slug].tsx index 7708e8d8fb1..86953e9853c 100644 --- a/apps/docs/pages/new/reference/cli/usage.tsx +++ b/apps/docs/pages/new/reference/cli/[...slug].tsx @@ -1,15 +1,25 @@ // @ts-expect-error import cliSpec from '~/../../spec/cli_v1_commands_new_shape.yaml' assert { type: 'yml' } import CodeBlock from '~/components/CodeBlock/CodeBlock' +import Options from '~/components/Options' +import Param from '~/components/Params' -type Flag = { +export type AcceptedValue = { + id: string + name: string + type: 'string' | 'boolean' | 'object' + description?: string +} + +export type Flag = { id: string name: string description: string default_value: string + accepted_values: AcceptedValue[] } -type Command = { +export type Command = { id: string title: string description: string @@ -26,25 +36,26 @@ export default function CliUsage() {
-

Usage

-
-

{cliSpec.info.description}

+

{cliSpec.info.description}

{cliSpec.commands.map((command: Command, commandIndex) => { return (
-
+
-

- {command.summary} +

+ $ {command.title}

+

+ {command.summary} +

{command.usage && ( @@ -54,8 +65,10 @@ export default function CliUsage() { )} {command.subcommands.length > 0 && ( - <> -

Available Commands

+
+

+ Available Commands +

    {command.subcommands.map((subcommand) => (
  • @@ -65,19 +78,26 @@ export default function CliUsage() {
  • ))}
- +
)} {command.flags.length > 0 && ( <> -

Options

-
    - {command.flags.map((flag) => ( -
  • -
    - {flag.name} -
    -

    {flag.description}

    -
  • +

    Flags

    +
      + {command.flags.map((flag: Flag) => ( + <> +
    • + + {flag?.accepted_values && ( + + {flag?.accepted_values.map((value) => { + return + })} + + )} + +
    • + ))}
    diff --git a/apps/docs/pages/new/reference/javascript/[...slug].tsx b/apps/docs/pages/new/reference/javascript/[...slug].tsx index 938769fe9cd..4ae1692f297 100644 --- a/apps/docs/pages/new/reference/javascript/[...slug].tsx +++ b/apps/docs/pages/new/reference/javascript/[...slug].tsx @@ -30,6 +30,8 @@ import { useRouter } from 'next/router' import { extractTsDocNode, generateParameters } from '~/lib/refGenerator/helpers' import { ComesFrom } from '~/components/ComesFrom' import Link from 'next/link' +import Param from '~/components/Params' +import Options from '~/components/Options' const marginTop = 256 export default function Ref(props) { @@ -228,11 +230,11 @@ export default function Ref(props) {

    updateUrl(item.id)} > {examples.functions[itemIndex].title ?? @@ -243,54 +245,53 @@ export default function Ref(props) { {shortText && ( <>

    - + /> */} )}

    {item.description && ( <> - -

    {item.description}

    + /> */} +

    {item.description}

    )} -
    {functionMarkdownContent && ( <> - + /> */} )} {item.notes && (
    - + /> */} {item.notes}
    )} {/* // parameters */} {parameters && ( - <> - + {/* + /> */}
    Parameters
    -
    +
      {parameters.map((param) => { // grab override params from yaml file const overrideParams = item.overrideParams @@ -303,76 +304,22 @@ export default function Ref(props) { const paramItem = overide?.length > 0 ? overide[0] : param return ( -
      -
      - - {paramItem.name ?? 'no-name'} - - - {paramItem.isOptional ? ( -
      - Optional -
      - ) : ( -
      - REQUIRED -
      - )} -
      - - {paramItem.type ?? 'no type'} - -
      -

      - {paramItem.description ?? 'nodescription'} -

      + {paramItem.subContent && (
      - {param.subContent.map((param) => { - return ( -
      -
      - - {param.name ?? 'no-name'} - - - {param.isOptional ? ( -
      - Optional -
      - ) : ( -
      - REQUIRED -
      - )} -
      - - {param.type ?? 'no type'} - -
      -

      - {param.description ?? 'nodescription'} -

      -
      - ) - })} + + {param.subContent.map((param) => { + return + })} +
      )} -
      + ) })} -
    +
{/*
*/} - +
)}