Skip to content

Commit 3d6d115

Browse files
authored
chore: fix breaking change in copyStaticFile usage (#178)
1 parent 3c5d800 commit 3d6d115

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

@theme/utils/blog-post.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const buildAndSortBlogPosts = async (postRoutes, context, outdir) => {
77
const posts = [];
88

99
const metadataContentRecord = await context.cache.load(BLOG_METADATA_PATH, 'yaml');
10-
const metadata = transformMetadata(metadataContentRecord.data, context.fs.cwd, outdir);
10+
const metadata = await transformMetadata(metadataContentRecord.data, context.fs.cwd, outdir);
1111

1212
for (const route of postRoutes) {
1313
const {
@@ -27,22 +27,22 @@ export const buildAndSortBlogPosts = async (postRoutes, context, outdir) => {
2727
.filter(Boolean),
2828
image:
2929
frontmatter.image &&
30-
copyStaticFile(context.fs.cwd, BLOG_IMAGES_DIR + frontmatter.image, outdir),
30+
(await copyStaticFile(context.fs.cwd, BLOG_IMAGES_DIR + frontmatter.image, outdir)),
3131
// content,
3232
});
3333
}
3434

3535
return { posts: posts.sort(sortByDatePredicate), metadata: metadataContentRecord.data };
3636
};
3737

38-
function transformMetadata(metadata, cwd, outdir) {
38+
async function transformMetadata(metadata, cwd, outdir) {
3939
const authors = new Map();
4040
const categories = new Map();
4141

4242
for (const author of metadata.authors) {
4343
authors.set(author.id, {
4444
...author,
45-
image: copyStaticFile(cwd, BLOG_IMAGES_DIR + author.image, outdir),
45+
image: await copyStaticFile(cwd, BLOG_IMAGES_DIR + author.image, outdir),
4646
});
4747
}
4848

0 commit comments

Comments
 (0)