Skip to content

Commit c1577ff

Browse files
authored
Replace gray-matter with @gr2m/gray-matter to control quotes in frontmatter (#57049)
1 parent 6b15caf commit c1577ff

File tree

13 files changed

+30
-60
lines changed

13 files changed

+30
-60
lines changed

next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs'
22
import path from 'path'
33

4-
import frontmatter from 'gray-matter'
4+
import frontmatter from '@gr2m/gray-matter'
55
import { getLogLevelNumber } from '#src/observability/logger/lib/log-levels.js'
66

77
// Replace imports with hardcoded values

package-lock.json

Lines changed: 16 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
"github-slugger": "^2.0.0",
283283
"glob": "11.0.2",
284284
"got": "^14.4.7",
285-
"gray-matter": "^4.0.3",
285+
"@gr2m/gray-matter": "4.0.3-with-pr-137",
286286
"hast-util-from-parse5": "^8.0.3",
287287
"hast-util-to-string": "^3.0.1",
288288
"hastscript": "^9.0.1",

src/automated-pipelines/lib/update-markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import walk from 'walk-sync'
22
import { existsSync, lstatSync, unlinkSync } from 'fs'
33
import path from 'path'
44
import { readFile, writeFile, readdir } from 'fs/promises'
5-
import matter from 'gray-matter'
5+
import matter from '@gr2m/gray-matter'
66
import { rimraf } from 'rimraf'
77
import { mkdirp } from 'mkdirp'
88
import { difference, isEqual } from 'lodash-es'

src/automated-pipelines/tests/update-markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'path'
55

66
import { afterAll, beforeAll, describe, expect, test } from 'vitest'
77
import { mkdirp } from 'mkdirp'
8-
import matter from 'gray-matter'
8+
import matter from '@gr2m/gray-matter'
99
import type { FrontmatterVersions } from '@/types'
1010

1111
import { updateContentDirectory } from '../lib/update-markdown'

src/codeql-cli/scripts/sync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import walk from 'walk-sync'
44
import { mkdirp } from 'mkdirp'
55
import { execFileSync, execSync } from 'child_process'
66
import path from 'path'
7-
import matter from 'gray-matter'
7+
import matter from '@gr2m/gray-matter'
88
import { rimraf } from 'rimraf'
99

1010
import { updateContentDirectory } from '../../automated-pipelines/lib/update-markdown'

src/content-linter/lib/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { addError, filterTokens } from 'markdownlint-rule-helpers'
2-
import matter from 'gray-matter'
2+
import matter from '@gr2m/gray-matter'
33

44
// Adds an error object with details conditionally via the onError callback
55
export function addFixErrorDetail(onError, lineNumber, expected, actual, range, fixInfo) {

src/data-directory/lib/data-directory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import walk from 'walk-sync'
55
import yaml from 'js-yaml'
66
import { isRegExp, setWith } from 'lodash-es'
77
import filenameToKey from './filename-to-key'
8-
import matter from 'gray-matter'
8+
import matter from '@gr2m/gray-matter'
99

1010
interface DataDirectoryOptions {
1111
preprocess?: (content: string) => string

src/data-directory/lib/get-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'fs'
22
import path from 'path'
33

44
import yaml from 'js-yaml'
5-
import matter from 'gray-matter'
5+
import matter from '@gr2m/gray-matter'
66
import { merge, get } from 'lodash-es'
77

88
import languages from '@/languages/lib/languages'

src/frame/lib/read-frontmatter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import matter from 'gray-matter'
1+
import matter from '@gr2m/gray-matter'
22

33
import { validateJson } from '@/tests/lib/validate-json-schema'
44

@@ -15,7 +15,8 @@ function readFrontmatter(markdown, opts = {}) {
1515

1616
const reason = e.reason
1717
? // make this common error message a little easier to understand
18-
e.reason.startsWith('can not read a block mapping entry;')
18+
e.reason.startsWith('can not read a block mapping entry;') ||
19+
e.reason === 'bad indentation of a mapping entry'
1920
? defaultReason
2021
: e.reason
2122
: defaultReason

0 commit comments

Comments
 (0)