Files
supabase/apps/docs/content/navigation.references.ts
Charis fc164b5d07 Refactor/app router refs (#28095)
Migrates client SDK References to App Router. (Management and CLI API references aren't migrated yet, nor are self-hosting config references.)

Some notes:

Big changes to the way crawler pages are built and individual section URLs (e.g., javascript/select) are served. All of these used to be SSG-generated pages, but the number of heavy pages was just too much to handle -- slow as molasses and my laptop sounded like it was taking off, and CI sometimes refuses to build it all at all.

Tried various tricks with caching and pre-generating data but no dice.

So I changed to only building one copy of each SDK+version page, then serving the sub-URLs through a response rewrite. That's for the actual user-visible pages.

For the bot pages, each sub-URL needs to be its own page, but prebuilding it doesn't work, and rendering on demand from React components is too slow (looking for super-fast response here for SEO). Instead I changed to using an API route that serves very minimal, hand-crafted HTML. It looks ugly, but it's purely for the search bots.

You can test what bots see by running curl --user-agent "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" <URL_OF_PAGE>

Also added some smoke tests to run against prod for the crawler routes, since we don't keep an eye on those regularly, and Vercel config changes could surprise-break them. Tested the meta images on Open Graph and all seems to work fine.

With this approach, full production builds are really fast: ~5 minutes

Starts using the new type spec handling, which is better at finding params automatically, so I could remove some of the manually written ones from the spec files.
2024-08-13 16:12:59 -04:00

124 lines
2.5 KiB
TypeScript

export const REFERENCES = {
javascript: {
type: 'sdk',
name: 'JavaScript',
library: 'supabase-js',
libPath: 'javascript',
versions: ['v2', 'v1'],
typeSpec: true,
icon: 'reference-javascript',
meta: {
v2: {
libId: 'reference_javascript_v2',
specFile: 'supabase_js_v2',
},
v1: {
libId: 'reference_javascript_v1',
specFile: 'supabase_js_v1',
},
},
},
dart: {
type: 'sdk',
name: 'Flutter',
library: 'supabase-dart',
libPath: 'dart',
versions: ['v2', 'v1'],
icon: 'reference-dart',
meta: {
v2: {
libId: 'reference_dart_v2',
specFile: 'supabase_dart_v2',
},
v1: {
libId: 'reference_dart_v1',
specFile: 'supabase_dart_v1',
},
},
},
csharp: {
type: 'sdk',
name: 'C#',
library: 'supabase-csharp',
libPath: 'csharp',
versions: ['v1', 'v0'],
icon: 'reference-csharp',
meta: {
v1: {
libId: 'reference_csharp_v1',
specFile: 'supabase_csharp_v1',
},
v0: {
libId: 'reference_csharp_v0',
specFile: 'supabase_csharp_v0',
},
},
},
swift: {
type: 'sdk',
name: 'Swift',
library: 'supabase-swift',
libPath: 'swift',
versions: ['v2', 'v1'],
icon: 'reference-swift',
meta: {
v2: {
libId: 'reference_swift_v2',
specFile: 'supabase_swift_v2',
},
v1: {
libId: 'reference_swift_v1',
specFile: 'supabase_swift_v1',
},
},
},
kotlin: {
type: 'sdk',
name: 'Kotlin',
library: 'supabase-kt',
libPath: 'kotlin',
versions: ['v2', 'v1'],
icon: 'reference-kotlin',
meta: {
v2: {
libId: 'reference_kotlin_v2',
specFile: 'supabase_kt_v2',
},
v1: {
libId: 'reference_kotlin_v1',
specFile: 'supabase_kt_v1',
},
},
},
python: {
type: 'sdk',
name: 'Python',
library: 'supabase-py',
libPath: 'python',
versions: ['v2'],
icon: 'reference-python',
meta: {
v2: {
libId: 'reference_python_v2',
specFile: 'supabase_py_v2',
},
},
},
cli: {
type: 'cli',
name: 'CLI',
versions: [],
icon: 'reference-cli',
},
api: {
type: 'api',
name: 'API',
versions: [],
icon: 'reference-api',
},
} as const
export const clientSdkIds = Object.keys(REFERENCES).filter(
(reference) => REFERENCES[reference].type === 'sdk'
)