Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: last-changed script to handle toml frontmatter (#29208)

Charis66e363e29d82
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 7f3e7dd242e..cdadd2ec720 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -79,6 +79,7 @@
"remark-gfm": "^3.0.1",
"remark-math": "^6.0.0",
"shared-data": "*",
+ "toml": "^3.0.0",
"ui": "*",
"ui-patterns": "*",
"unist-builder": "^3.0.1",
diff --git a/apps/docs/scripts/last-changed.ts b/apps/docs/scripts/last-changed.ts
index da1ea096b0a..81629fc11b7 100644
--- a/apps/docs/scripts/last-changed.ts
+++ b/apps/docs/scripts/last-changed.ts
@@ -21,6 +21,7 @@ import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { parseArgs } from 'node:util'
import { SimpleGit, simpleGit } from 'simple-git'
+import toml from 'toml'
import { Section } from './helpers.mdx'
@@ -157,7 +158,15 @@ async function updateTimestamps(
}
function processMdx(rawContent: string): Array<SectionWithChecksum> {
- const { content } = matter(rawContent)
+ let content: string
+ try {
+ content = matter(rawContent).content
+ } catch (err) {
+ content = matter(rawContent, {
+ language: 'toml',
+ engines: { toml: toml.parse.bind(toml) },
+ }).content
+ }
const GLOBAL_HEADING_REGEX = /(?:^|\n)(?=#+\s+[^\n]+[\n$])/g
const sections = content.split(GLOBAL_HEADING_REGEX)
diff --git a/package-lock.json b/package-lock.json
index b0a7d2d6ea2..b8bcff1b7bf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -904,6 +904,7 @@
"remark-gfm": "^3.0.1",
"remark-math": "^6.0.0",
"shared-data": "*",
+ "toml": "^3.0.0",
"ui": "*",
"ui-patterns": "*",
"unist-builder": "^3.0.1",
@@ -1405,6 +1406,11 @@
"node": ">=14.0.0"
}
},
+ "apps/docs/node_modules/toml": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz",
+ "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="
+ },
"apps/docs/node_modules/vite-node": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.0.3.tgz",