From e9e82c6ce5427e5ce838cda27798de26e72247c2 Mon Sep 17 00:00:00 2001
From: Sophia Michelle Andren <20441876+sandren@users.noreply.github.com>
Date: Mon, 29 Jan 2024 03:17:53 +0000
Subject: [PATCH 1/2] feat(website): switch to shiki
---
packages/website/package.json | 2 +-
.../website/src/components/client-only.tsx | 22 -------------
packages/website/src/components/code.tsx | 21 ++++++++-----
packages/website/src/components/mdx.tsx | 6 ++--
packages/website/src/templates/home-page.tsx | 4 +--
pnpm-lock.yaml | 31 +++++++++----------
6 files changed, 33 insertions(+), 53 deletions(-)
delete mode 100644 packages/website/src/components/client-only.tsx
diff --git a/packages/website/package.json b/packages/website/package.json
index 3c35f2c62..e859afe4a 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -10,7 +10,6 @@
"start": "waku start --with-ssr"
},
"dependencies": {
- "bright": "^0.8.4",
"clsx": "^2.1.0",
"framer-motion": "^11.0.3",
"jotai": "^2.6.3",
@@ -25,6 +24,7 @@
"autoprefixer": "^10.4.17",
"prettier": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11",
+ "shiki": "1.0.0-beta.0",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3",
"vite": "5.0.12"
diff --git a/packages/website/src/components/client-only.tsx b/packages/website/src/components/client-only.tsx
deleted file mode 100644
index b1830e60c..000000000
--- a/packages/website/src/components/client-only.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-'use client';
-
-import { useEffect, useState } from 'react';
-import type { ReactNode } from 'react';
-
-type ClientOnlyProps = {
- children: ReactNode;
-};
-
-export const ClientOnly = ({ children }: ClientOnlyProps) => {
- const [hasMounted, setHasMounted] = useState(false);
-
- useEffect(() => {
- setHasMounted(true);
- }, []);
-
- if (!hasMounted) {
- return null;
- }
-
- return children;
-};
diff --git a/packages/website/src/components/code.tsx b/packages/website/src/components/code.tsx
index e5dd00ba3..9bc143562 100644
--- a/packages/website/src/components/code.tsx
+++ b/packages/website/src/components/code.tsx
@@ -1,14 +1,21 @@
-import { Code as BrightCode } from 'bright';
+import { getHighlighter } from 'shiki';
-import { ClientOnly } from './client-only.js';
import theme from '../theme.json';
type CodeProps = {
code: string;
};
-export const Code = ({ code, ...rest }: CodeProps) => (
-
),
blockquote: ({ children, ...rest }: any) => {
return (
- ++