chore: update deps

This commit is contained in:
Andrea
2024-02-05 17:41:19 +01:00
parent 6b453ddc2d
commit 398e00542b
6 changed files with 26 additions and 86 deletions

View File

@@ -1,7 +1,6 @@
import { remarkCodeHike } from "@code-hike/mdx";
import { readdir, readFile } from "fs/promises";
import { bundleMDX } from "mdx-bundler";
import codeHikeTheme from "shiki/themes/one-dark-pro.json";
type FrontMatter = {
title: string;
@@ -11,7 +10,7 @@ type FrontMatter = {
export const getMdxFile = async (file: string) => {
return bundleMDX<FrontMatter>({
source: (await readFile(`${__dirname}/../posts/${file}.mdx`)).toString(),
source: (await readFile(`posts/${file}.mdx`)).toString(),
mdxOptions(options) {
return {
rehypePlugins: [...(options.rehypePlugins ?? [])],
@@ -20,7 +19,7 @@ export const getMdxFile = async (file: string) => {
[
remarkCodeHike,
{
theme: codeHikeTheme,
theme: "one-dark-pro",
lineNumbers: true,
showCopyButton: true,
autoImport: true,
@@ -33,20 +32,20 @@ export const getMdxFile = async (file: string) => {
};
export const findPosts = async () => {
const files = await readdir(`${__dirname}/../posts`);
const files = await readdir(`posts`);
const posts: (FrontMatter & {
filename: string;
})[] = [];
for (const file of files.filter((file) => file.endsWith(".mdx"))) {
const { frontmatter } = await bundleMDX<FrontMatter>({
source: (await readFile(`${__dirname}/../posts/${file}`)).toString(),
source: (await readFile(`posts/${file}`)).toString(),
mdxOptions() {
return {
remarkPlugins: [
[
remarkCodeHike,
{
theme: codeHikeTheme,
theme: "one-dark-pro",
lineNumbers: true,
showCopyButton: true,
autoImport: true,