Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3123,28 +3123,28 @@ export const self_hosting: NavMenuConstant = {
name: 'Add Reverse Proxy with HTTPS',
url: '/guides/self-hosting/self-hosted-proxy-https',
},
{ name: 'Upgrade to Postgres 17', url: '/guides/self-hosting/postgres-upgrade-17' },
{ name: 'Remove superuser access', url: '/guides/self-hosting/remove-superuser-access' },
{ name: 'Update your deployment', url: '/guides/self-hosting/updating' },
{
name: 'How-to Guides',
items: [
{ name: 'Upgrade to Postgres 17', url: '/guides/self-hosting/postgres-upgrade-17' },
{ name: 'Remove superuser access', url: '/guides/self-hosting/remove-superuser-access' },
{ name: 'Run Self-Hosted Functions', url: '/guides/self-hosting/self-hosted-functions' },
{ name: 'Configure S3 Storage', url: '/guides/self-hosting/self-hosted-s3' },
{ name: 'Add Custom Email Templates', url: '/guides/self-hosting/custom-email-templates' },
{ name: 'Enable MCP server', url: '/guides/self-hosting/enable-mcp' },
{ name: 'Configure Social Login (OAuth)', url: '/guides/self-hosting/self-hosted-oauth' },
{ name: 'Configure Phone Login & MFA', url: '/guides/self-hosting/self-hosted-phone-mfa' },
{ name: 'Add Custom Email Templates', url: '/guides/self-hosting/custom-email-templates' },
{ name: 'Configure SAML 2.0 SSO', url: '/guides/self-hosting/self-hosted-saml-sso' },
{ name: 'Enable MCP server', url: '/guides/self-hosting/enable-mcp' },
{
name: 'Build Custom Extensions',
url: '/guides/self-hosting/custom-postgres-extensions',
},
{
name: 'Restore Project from Platform',
url: '/guides/self-hosting/restore-from-platform',
},
{ name: 'Copy Storage from Platform', url: '/guides/self-hosting/copy-from-platform-s3' },
{
name: 'Build Custom Extensions',
url: '/guides/self-hosting/custom-postgres-extensions',
},
],
},
{
Expand Down
1 change: 1 addition & 0 deletions apps/kb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@astrojs/react": "^6.0.4",
"astro": "^7.2.6",
"lucide-react": "*",
"react": "catalog:",
"react-dom": "catalog:",
"ui": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion apps/kb/src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const menus = [
]

const triggerClass =
'h-(--header-height) p-2 border-transparent font-normal rounded-none text-foreground-light hover:text-foreground data-open:text-foreground! border-0 focus-ring focus-visible:text-foreground h-full focus-visible:rounded-sm shadow-none!'
'h-(--header-height) p-2 bg-transparent border-transparent font-normal rounded-none text-foreground-light hover:text-foreground data-open:text-foreground! border-0 focus-ring focus-visible:text-foreground h-full focus-visible:rounded-sm shadow-none!'
// docs gates this at `md:absolute` (its own base component class) because its
// nav is hidden entirely below `lg` in favor of a separate mobile menu. kb
// doesn't have that split — the nav is always visible — so `absolute` is
Expand Down
18 changes: 18 additions & 0 deletions apps/kb/src/content.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineCollection } from 'astro:content'
import { glob } from 'astro/loaders'
import { z } from 'astro/zod'

// Every entry here is rendered through GuideLayout by
// src/pages/guides/[...slug].astro — dropping a new file in
// src/content/guides doesn't need any per-file layout wiring.
const guides = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/guides' }),
schema: z.object({
title: z.string(),
description: z.string().optional(),
topics: z.array(z.string()).optional(),
github_url: z.string().optional(),
}),
})

export const collections = { guides }
81 changes: 81 additions & 0 deletions apps/kb/src/content/guides/sample-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: 'Markdown elements sample'
description: 'A lorem ipsum sample guide exercising every base Markdown element supported by the guide layout.'
topics: ['example', 'markdown']
github_url: 'https://github.com/supabase/supabase/discussions/0000000'
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

## Heading level 2

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. This paragraph mixes **bold text**, _italic text_,
**_bold italic text_**, ~~strikethrough text~~, and `inline code`.

### Heading level 3

Here's a [link to the Astro docs](https://docs.astro.build/en/basics/layouts/),
followed by an unordered list with a nested list:

- Excepteur sint occaecat cupidatat non proident
- Sunt in culpa qui officia deserunt mollit anim id est laborum
- Nested item one
- Nested item two
- Curabitur blandit tempus porttitor

#### Heading level 4

And an ordered list with a nested list:

1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
1. Nested step one
2. Nested step two
3. Sed do eiusmod tempor incididunt

##### Heading level 5

> Neque porro quisquam est qui dolorem ipsum quia dolor sit amet,
> consectetur, adipisci velit.
>
> > Nested blockquote: at vero eos et accusamus et iusto odio dignissimos.

###### Heading level 6

A fenced code block with a language tag:

```js
function add(a, b) {
return a + b
}

console.log(add(2, 3))
```

And another in a different language:

```bash
npm install
npm run dev
```

A table:

| Element | Supported | Notes |
| -------- | --------- | ---------------------------- |
| Headings | Yes | h2 through h6 |
| Tables | Yes | via GitHub-flavored Markdown |
| Images | Yes | see below |

An image:

![Placeholder image](https://placehold.co/800x400?text=Placeholder+Image)

---

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium
doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore
veritatis et quasi architecto beatae vitae dicta sunt explicabo.
39 changes: 39 additions & 0 deletions apps/kb/src/layouts/GuideLayout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
import { Github } from 'lucide-react'
import { Badge } from 'ui'

import Layout from './Layout.astro'

interface Props {
title: string
description?: string
topics?: string[]
github_url?: string
}

const { title, description, topics = [], github_url } = Astro.props
---

<Layout title={title} description={description}>
<article class="prose max-w-3xl mx-auto px-6 py-16">
<h1>{title}</h1>
{description && <p class="lead">{description}</p>}
{
topics.length > 0 && (
<div class="flex flex-wrap gap-2">
{topics.map((topic) => <Badge>{topic}</Badge>)}
</div>
)
}
<slot />
{
github_url && (
<p>
<a href={github_url} target="_blank" rel="noreferrer" class="inline-flex items-center gap-1.5">
<Github size={16} /> Go to the GitHub discussion
</a>
</p>
)
}
</article>
</Layout>
10 changes: 9 additions & 1 deletion apps/kb/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
---
import { Header } from '../components/Header'
import '../styles/globals.css'

interface Props {
title: string
description?: string
}

const { title, description } = Astro.props
---

<!doctype html>
Expand All @@ -9,6 +16,7 @@ import '../styles/globals.css'
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="robots" content="noindex, nofollow" />
{description && <meta name="description" content={description} />}
<script is:inline>
// Set data-theme on <html> before first paint, so the page doesn't flash
// the wrong theme while this loads. Defaults to dark (no system-preference
Expand Down Expand Up @@ -50,7 +58,7 @@ import '../styles/globals.css'
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap"
/>
<title>Supabase Knowledge Base</title>
<title>{title} | Supabase Knowledge Base</title>
</head>
<body>
<Header client:load />
Expand Down
21 changes: 21 additions & 0 deletions apps/kb/src/pages/guides/[...slug].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
import { getCollection, render } from 'astro:content'

import GuideLayout from '../../layouts/GuideLayout.astro'

export async function getStaticPaths() {
const guides = await getCollection('guides')
return guides.map((guide) => ({
params: { slug: guide.id },
props: { guide },
}))
}

const { guide } = Astro.props
const { title, description, topics, github_url } = guide.data
const { Content } = await render(guide)
---

<GuideLayout title={title} description={description} topics={topics} github_url={github_url}>
<Content />
</GuideLayout>
2 changes: 1 addition & 1 deletion apps/kb/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Hero } from '../components/Hero'
import Layout from '../layouts/Layout.astro'
---

<Layout>
<Layout title="Home" description="In-depth guides, tutorials, and explainers for best practices for Supabase databases.">
<Hero />
</Layout>
6 changes: 6 additions & 0 deletions apps/kb/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ h6:not(.font-mono),
::file-selector-button {
border-color: var(--border-default, currentColor);
}

/* TEMPORARY UNTIL WE IMPLEMENT OUR OWN CODE COMPONENT */
.prose pre code {
padding: 1rem;
display: inline-block;
}
1 change: 1 addition & 0 deletions apps/studio/TANSTACK_MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ These are the layout-only TanStack files. Most hold a single product layout comp

### Project shell — `/advisors/*`

- [x] A `routes/project/$ref/advisors/health.tsx` ← `pages/project/[ref]/advisors/health.tsx`
- [x] A `routes/project/$ref/advisors/performance.tsx` ← `pages/project/[ref]/advisors/performance.tsx`
- [x] A `routes/project/$ref/advisors/security.tsx` ← `pages/project/[ref]/advisors/security.tsx`
- [x] A `routes/project/$ref/advisors/rules/performance.tsx` ← `pages/project/[ref]/advisors/rules/performance.tsx`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type LintInfo = {
link: (args: { projectRef: string; metadata: Lint['metadata'] }) => string
linkText: string
docsLink: string
category: 'security' | 'performance'
category: 'security' | 'performance' | 'health'
}

export const LINT_TABS: ReadonlyArray<{
Expand Down
17 changes: 16 additions & 1 deletion apps/studio/components/interfaces/Linter/Linter.utils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Ruler } from 'lucide-react'
import { isValidElement } from 'react'
import { describe, expect, it } from 'vitest'

import { lintInfoMap } from './Linter.utils'
import { lintInfoMap, parseLinterLevel } from './Linter.utils'
import { LINTER_LEVELS } from '@/components/interfaces/Linter/Linter.constants'
import { Lint } from '@/data/lint/lint-query'

const projectRef = 'abc'
Expand Down Expand Up @@ -83,3 +84,17 @@ describe('Linter.utils lintInfoMap pitr_archiving_stale entry', () => {
expect(info!.docsLink).toContain('/guides/platform/backups#point-in-time-recovery')
})
})

describe('parseLinterLevel', () => {
it('returns the matching level', () => {
expect(parseLinterLevel('ERROR')).toBe(LINTER_LEVELS.ERROR)
expect(parseLinterLevel('WARN')).toBe(LINTER_LEVELS.WARN)
expect(parseLinterLevel('INFO')).toBe(LINTER_LEVELS.INFO)
})

it('returns undefined for values that are not a level', () => {
expect(parseLinterLevel('error')).toBeUndefined()
expect(parseLinterLevel('SOMETHING_ELSE')).toBeUndefined()
expect(parseLinterLevel(undefined)).toBeUndefined()
})
})
Loading
Loading