diff --git a/app/services/articleService.ts b/app/services/articleService.ts index ffde83a..4fa0a52 100644 --- a/app/services/articleService.ts +++ b/app/services/articleService.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; import matter from 'gray-matter'; import { Article } from '../types/Article'; import { Link } from '../types/Link'; @@ -1031,7 +1031,7 @@ function updateDocumentDbLocalContent(content: string): string { export function getArticleContent(): Article { const contentPath = path.join(articlesDirectory, 'content.yml'); const fileContents = fs.readFileSync(contentPath, 'utf8'); - return yaml.load(fileContents) as Article; + return loadYaml(fileContents) as Article; } export function getArticleNavigation(section: string): Link[] { @@ -1042,7 +1042,7 @@ export function getArticleNavigation(section: string): Link[] { } const fileContents = fs.readFileSync(navPath, 'utf8'); - const rawLinks = yaml.load(fileContents) as Link[]; + const rawLinks = loadYaml(fileContents) as Link[]; const normalizedLinks = splitPrebuiltNavigation(section, rawLinks); // Transform Markdown file links to published relative URIs diff --git a/package-lock.json b/package-lock.json index 513c4f9..1f66f5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "change-case": "^5.4.4", "gray-matter": "^4.0.3", "handlebars": "^4.7.8", - "js-yaml": "^4.1.1", + "js-yaml": "^5.2.2", "next": "^16.2.12", "pluralize": "^8.0.0", "react": "^19.2.3", @@ -943,6 +943,29 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@eslint/eslintrc/node_modules/minimatch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", @@ -6488,9 +6511,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", - "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.2.tgz", + "integrity": "sha512-dayzUzKkJ1MkuUtZglSebU43utNXH0OWQByK9rKOOuYIO8M5TV1y+n8ALMdG0rdzBnfNkOmZEqrURepb0ejqBw==", "funding": [ { "type": "github", @@ -6506,7 +6529,7 @@ "argparse": "^2.0.1" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "js-yaml": "bin/js-yaml.mjs" } }, "node_modules/jsesc": { diff --git a/package.json b/package.json index cd14552..8fd0934 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "change-case": "^5.4.4", "gray-matter": "^4.0.3", "handlebars": "^4.7.8", - "js-yaml": "^4.1.1", + "js-yaml": "^5.2.2", "next": "^16.2.12", "pluralize": "^8.0.0", "react": "^19.2.3", diff --git a/scripts/compile-samples.tsx b/scripts/compile-samples.tsx index 0646d5d..1ff7893 100644 --- a/scripts/compile-samples.tsx +++ b/scripts/compile-samples.tsx @@ -5,7 +5,7 @@ import path from 'path'; import { spawnSync } from 'child_process'; import React from 'react'; import { render, Box, Text } from 'ink'; -import yaml from 'js-yaml'; +import { load as loadYaml } from 'js-yaml'; /** * Configuration for the samples registry @@ -103,7 +103,7 @@ async function compileSamples(config: SamplesConfig): Promise { throw new Error(`Registry file not found: ${config.registryFile}`); } - const registry = yaml.load(fs.readFileSync(registryPath, 'utf8')) as Registry; + const registry = loadYaml(fs.readFileSync(registryPath, 'utf8')) as Registry; if (!registry?.samples || !Array.isArray(registry.samples)) { throw new Error('registry.yml must contain a top-level "samples" array');