Skip to content

Commit 9f2b609

Browse files
committed
fix(docs-tools): use dynamic import for authors data
1 parent 59ed841 commit 9f2b609

File tree

2 files changed

+6
-177
lines changed

2 files changed

+6
-177
lines changed

packages/tools/docs-tools/src/data/authors.json

-176
This file was deleted.

packages/tools/docs-tools/src/remarkFrontmatterToProps.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { compareDesc } from 'date-fns';
2+
import { join } from 'path';
23
import yaml from 'js-yaml';
3-
import authors from './data/authors.json';
44
import type {
55
DocsRootContent,
66
IAuthorInfo,
@@ -68,9 +68,14 @@ const getBlogAuthorInfo = async (
6868
const authorId = data.authorId;
6969
if (!authorId) return;
7070

71+
const authorFilePath = join(process.cwd(), 'src/data/authors.json');
72+
73+
const authors = await import(authorFilePath);
74+
7175
const author = (authors as IAuthorInfo[]).find(
7276
(author) => author.id === authorId,
7377
);
78+
7479
if (!author) return;
7580

7681
author.posts = await getLatestBlogPostsOfAuthor(author);

0 commit comments

Comments
 (0)