Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use experimental Remix Vite plugin #114

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
20825f3
Use remix vite plugin
lachlancollins Nov 5, 2023
003cdac
Run prettier
lachlancollins Nov 5, 2023
758593c
Fix missing stylesheets
lachlancollins Nov 5, 2023
2065b98
Add remark-shiki-twoslash
lachlancollins Nov 5, 2023
f9b584c
Add language indicator to code blocks
lachlancollins Nov 5, 2023
d012259
More CodeBlock style fixes
lachlancollins Nov 5, 2023
c7188cb
Merge branch 'v2-part-2' into vite-plugin
lachlancollins Nov 5, 2023
cefb6ed
Merge branch 'v2-part-2' into vite-plugin
lachlancollins Nov 5, 2023
93f309c
Light/dark themes for shiki
lachlancollins Nov 5, 2023
07795f0
Fix CodeBlock borders
lachlancollins Nov 5, 2023
6f90e4c
Start replacing react-icons
lachlancollins Nov 5, 2023
368c604
Use named exports from react
lachlancollins Nov 5, 2023
a244f4c
Don't render lang if absent
lachlancollins Nov 5, 2023
3f9ea14
Add more local Icones icons
lachlancollins Nov 5, 2023
9b971a7
Replace all remaining icons
lachlancollins Nov 5, 2023
ade5fd9
Fix remark-shiki-twoslash broken CJS/ESM compatibility
lachlancollins Nov 5, 2023
62f0971
Fix @docsearch/react ESM issue
lachlancollins Nov 5, 2023
4292515
Fix inline code highlights
lachlancollins Nov 5, 2023
0d61120
Merge branch 'main' into vite-plugin
lachlancollins Nov 6, 2023
afab83f
Fixed incorrect icons
lachlancollins Nov 6, 2023
a0045bf
Actually fix icon, comment css source
lachlancollins Nov 6, 2023
1d36381
Regenerate pnpm-lock.yaml
lachlancollins Nov 7, 2023
a2aeb37
Remove unnecessary server-side dynamic imports
lachlancollins Nov 7, 2023
69b2f90
Merge branch 'main' into vite-plugin
lachlancollins Jan 3, 2024
9b148c3
Update to remix v2.4
lachlancollins Jan 3, 2024
c8eba50
Latest experimental vite changes
lachlancollins Jan 3, 2024
ef27769
Merge branch 'main' into vite-plugin
lachlancollins Jan 9, 2024
284111c
Add skipLibCheck as per migration guide
lachlancollins Jan 9, 2024
6728c0c
Add react-icons back
lachlancollins Jan 9, 2024
d4a4b6c
Run format
lachlancollins Jan 9, 2024
c8d8bd0
Fix strict route exports
lachlancollins Jan 9, 2024
4a1d93f
Fix react-icons
lachlancollins Jan 9, 2024
8437cae
Remove custom icons
lachlancollins Jan 9, 2024
b484014
Start removing shiki
lachlancollins Jan 9, 2024
3ac8d0f
Working prism css
lachlancollins Jan 9, 2024
6d5debf
Reduce diff
lachlancollins Jan 9, 2024
0cf640c
Fix css
lachlancollins Jan 9, 2024
4f632bd
Fix react-icons import
lachlancollins Jan 9, 2024
e4736e5
Add vite-plugin-cjs-interop
lachlancollins Jan 9, 2024
cf4e0e2
Fix DocSearch import
lachlancollins Jan 9, 2024
0648751
Merge branch 'main' into vite-plugin
lachlancollins Jan 19, 2024
8c893ea
Fix lockfile
lachlancollins Jan 19, 2024
68dcc16
Fix merge
lachlancollins Jan 19, 2024
0113165
More fixes
lachlancollins Jan 19, 2024
1918142
Merge branch 'main' into vite-plugin
lachlancollins Jan 20, 2024
09421c6
Delete duplicate config
lachlancollins Jan 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/api
**/build
**/public
pnpm-lock.yaml
6 changes: 3 additions & 3 deletions app/components/Carbon.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react'
import { useEffect, useRef } from 'react'

export function Carbon() {
const ref = React.useRef<HTMLDivElement>(null!)
const ref = useRef<HTMLDivElement>(null!)

React.useEffect(() => {
useEffect(() => {
ref.current.innerHTML = ''
const s = document.createElement('script')
s.id = '_carbonads_js'
Expand Down
2 changes: 0 additions & 2 deletions app/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { FaCopy } from 'react-icons/fa'
import { svelteHighlighter } from '~/utils/svelteHighlighter'
// Add back additional language support after `prism-react` upgrade
;(typeof global !== 'undefined' ? global : window).Prism = Prism
require('prismjs/components/prism-diff')
require('prismjs/components/prism-bash')

// @ts-ignore Alias markup as vue highlight
Prism.languages.vue = Prism.languages.markup
Expand Down
2 changes: 1 addition & 1 deletion app/components/Doc.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FaEdit } from 'react-icons/fa'
import { FaEdit } from 'react-icons/fa/index'
import { DocTitle } from '~/components/DocTitle'
import { RenderMarkdown } from '~/components/RenderMarkdown'

Expand Down
4 changes: 3 additions & 1 deletion app/components/DocTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function DocTitle(props: { children: React.ReactNode }) {
import type { ReactNode } from 'react'

export function DocTitle(props: { children: ReactNode }) {
return (
<>
<h1
Expand Down
17 changes: 9 additions & 8 deletions app/components/Docs.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, useRef } from 'react'
import { DocSearch } from '@docsearch/react'
import * as React from 'react'
import { CgClose, CgMenuLeft } from 'react-icons/cg'
import { FaArrowLeft, FaArrowRight, FaTimes } from 'react-icons/fa'
import { CgClose, CgMenuLeft } from 'react-icons/cg/index'
import { FaArrowLeft, FaArrowRight, FaTimes } from 'react-icons/fa/index'
import { NavLink, Outlet, useMatches } from '@remix-run/react'
import { last } from '~/utils/utils'
import { Carbon } from '~/components/Carbon'
Expand All @@ -12,6 +12,7 @@ import { Select } from '~/components/Select'
import { useLocalStorage } from '~/utils/useLocalStorage'
import { DocsCalloutQueryGG } from '~/components/DocsCalloutQueryGG'
import { DocsCalloutBytes } from '~/components/DocsCalloutBytes'
import type { ReactNode } from 'react'

export type DocsConfig = {
docSearch: {
Expand All @@ -20,9 +21,9 @@ export type DocsConfig = {
apiKey: string
}
menu: {
label: string | React.ReactNode
label: string | ReactNode
children: {
label: string | React.ReactNode
label: string | ReactNode
to: string
badge?: string
}[]
Expand All @@ -43,7 +44,7 @@ export function Docs({
colorFrom: string
colorTo: string
textColor: string
logo: React.ReactNode
logo: ReactNode
config: DocsConfig
framework?: SelectProps
version?: SelectProps
Expand All @@ -55,9 +56,9 @@ export function Docs({

const isExample = matches.some((d) => d.pathname.includes('/examples/'))

const detailsRef = React.useRef<HTMLElement>(null!)
const detailsRef = useRef<HTMLElement>(null!)

const flatMenu = React.useMemo(
const flatMenu = useMemo(
() => config.menu.flatMap((d) => d.children),
[config.menu]
)
Expand Down
3 changes: 2 additions & 1 deletion app/components/DocsCalloutBytes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import BytesForm from '~/components/BytesForm'
import type { HTMLProps } from 'react'

export function DocsCalloutBytes(props: React.HTMLProps<HTMLDivElement>) {
export function DocsCalloutBytes(props: HTMLProps<HTMLDivElement>) {
return (
<div className="space-y-4" {...props}>
<div className="space-y-1 md:space-y-2">
Expand Down
3 changes: 2 additions & 1 deletion app/components/DocsCalloutQueryGG.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LogoQueryGGSmall } from '~/components/LogoQueryGGSmall'
import type { HTMLProps } from 'react'

export function DocsCalloutQueryGG(props: React.HTMLProps<HTMLDivElement>) {
export function DocsCalloutQueryGG(props: HTMLProps<HTMLDivElement>) {
return (
<div className="space-y-4" {...props}>
<h6 className="text-[.7rem] md:text-[.9em] uppercase font-black">
Expand Down
4 changes: 3 additions & 1 deletion app/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function Logo(props: React.HTMLProps<HTMLDivElement>) {
import type { HTMLProps } from 'react'

export function Logo(props: HTMLProps<HTMLDivElement>) {
return (
<div {...props}>
<svg
Expand Down
4 changes: 3 additions & 1 deletion app/components/LogoColor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function LogoColor(props: React.HTMLProps<HTMLDivElement>) {
import type { HTMLProps } from 'react'

export function LogoColor(props: HTMLProps<HTMLDivElement>) {
return (
<div {...props}>
<svg
Expand Down
4 changes: 3 additions & 1 deletion app/components/LogoQueryGG.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function LogoQueryGG(props: React.HTMLProps<HTMLDivElement>) {
import type { HTMLProps } from 'react'

export function LogoQueryGG(props: HTMLProps<HTMLDivElement>) {
return (
<div {...props}>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 361">
Expand Down
4 changes: 3 additions & 1 deletion app/components/LogoQueryGGSmall.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function LogoQueryGGSmall(props: React.HTMLProps<HTMLDivElement>) {
import type { HTMLProps } from 'react'

export function LogoQueryGGSmall(props: HTMLProps<HTMLDivElement>) {
return (
<div {...props}>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 130">
Expand Down
2 changes: 1 addition & 1 deletion app/components/QueryGGBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IoIosClose } from 'react-icons/io'
import { IoIosClose } from 'react-icons/io/index'
import { useLocalStorage } from '~/utils/useLocalStorage'
import { useClientOnlyRender } from '~/utils/useClientOnlyRender'

Expand Down
6 changes: 3 additions & 3 deletions app/components/RootDocument.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import {
Links,
LiveReload,
Expand All @@ -8,13 +7,14 @@ import {
useMatches,
useNavigation,
} from '@remix-run/react'
import { CgSpinner } from 'react-icons/cg'
import { CgSpinner } from 'react-icons/cg/index'
import type { ReactNode } from 'react'

export function RootDocument({
children,
title,
}: {
children: React.ReactNode
children: ReactNode
title?: string
}) {
const navigation = useNavigation()
Expand Down
3 changes: 1 addition & 2 deletions app/components/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Fragment } from 'react'
import { Listbox, Transition } from '@headlessui/react'

import { HiCheck, HiChevronDown } from 'react-icons/hi'
import { HiCheck, HiChevronDown } from 'react-icons/hi/index'
import { Form } from '@remix-run/react'

export type AvailableOptions = Record<
Expand Down
6 changes: 3 additions & 3 deletions app/components/SponsorPack.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import { useMemo } from 'react'
import { Pack, hierarchy } from '@visx/hierarchy'
import { ParentSize } from '@visx/responsive'
import { twMerge } from 'tailwind-merge'

export default function SponsorPack({ sponsors }: { sponsors: any }) {
const pack = React.useMemo(
const pack = useMemo(
() => ({
children: sponsors,
name: 'root',
Expand All @@ -14,7 +14,7 @@ export default function SponsorPack({ sponsors }: { sponsors: any }) {
[sponsors]
)

const root = React.useMemo(
const root = useMemo(
() =>
hierarchy(pack)
.sum((d) => 1 + d?.tier?.monthlyPriceInDollars)
Expand Down
6 changes: 3 additions & 3 deletions app/hooks/useSessionStorage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { useEffect, useState } from 'react'

export default function useSessionStorage(key, defaultValue = '') {
const [state, setState] = React.useState(() => {
const [state, setState] = useState(() => {
if (typeof document !== 'undefined') {
const data = sessionStorage.getItem(key)
if (data) {
Expand All @@ -16,9 +16,9 @@
return defaultValue
})

React.useEffect(() => {
useEffect(() => {
sessionStorage.setItem(key, JSON.stringify(state))
}, [state])

Check warning on line 21 in app/hooks/useSessionStorage.ts

View workflow job for this annotation

GitHub Actions / PR

React Hook useEffect has a missing dependency: 'key'. Either include it or remove the dependency array

return [state, setState]
}
29 changes: 5 additions & 24 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Outlet, isRouteErrorResponse, useRouteError } from '@remix-run/react'
import styles from '~/styles/app.css'
import carbonStyles from '~/styles/carbon.css'
import prismThemeLight from '~/styles/prismThemeLight.css'
import prismThemeDark from '~/styles/prismThemeDark.css'
import docSearchStyles from '@docsearch/css/dist/style.css'
import '~/styles/app.css'
import '~/styles/carbon.css'
import '~/styles/prismThemeLight.css'
import '~/styles/prismThemeDark.css'
import '@docsearch/css/dist/style.css'
import { seo } from '~/utils/seo'
import { RootDocument } from '~/components/RootDocument'
import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'
Expand All @@ -22,25 +22,6 @@ export const meta: MetaFunction = () => {

export const links: LinksFunction = () => {
return [
{ rel: 'stylesheet', href: styles },
{
rel: 'stylesheet',
href: prismThemeLight,
media: '(prefers-color-scheme: light)',
},
{
rel: 'stylesheet',
href: prismThemeDark,
media: '(prefers-color-scheme: dark)',
},
{
rel: 'stylesheet',
href: docSearchStyles,
},
{
rel: 'stylesheet',
href: carbonStyles,
},
{
rel: 'apple-touch-icon',
sizes: '180x180',
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import { json } from '@remix-run/node'
import { Carbon } from '~/components/Carbon'
import { twMerge } from 'tailwind-merge'
import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'
import { CgMusicSpeaker } from 'react-icons/cg'
import { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa/index'
import { CgMusicSpeaker } from 'react-icons/cg/index'
import { Footer } from '~/components/Footer'
import SponsorPack from '~/components/SponsorPack'
import { LinkOrA } from '~/components/LinkOrA'
Expand Down Expand Up @@ -559,7 +559,7 @@
right-0 top-0 -translate-y-1/3 translate-x-1/3
sm:opacity-20`}
>
<img src={discordImage} width={300} height={300} />

Check warning on line 562 in app/routes/_index.tsx

View workflow job for this annotation

GitHub Actions / PR

img elements must have an alt prop, either with meaningful text, or an empty string for decorative images
</div>
<div className={`sm:col-span-2`}>
<h3 className={`text-3xl`}>TanStack on Discord</h3>
Expand Down
1 change: 0 additions & 1 deletion app/routes/blog._index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { useLoaderData, Link } from '@remix-run/react'
import { json } from '@remix-run/node'
import { extractFrontMatter, fetchRepoFile } from '~/utils/documents.server'
Expand Down
6 changes: 3 additions & 3 deletions app/routes/blog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { CgClose, CgMenuLeft } from 'react-icons/cg'
import { useRef } from 'react'
import { CgClose, CgMenuLeft } from 'react-icons/cg/index'
import { Link, NavLink, Outlet } from '@remix-run/react'
import { DefaultErrorBoundary } from '~/components/DefaultErrorBoundary'
import { Carbon } from '~/components/Carbon'
Expand Down Expand Up @@ -44,7 +44,7 @@ export const meta: MetaFunction = () => {
}

export default function RouteBlog() {
const detailsRef = React.useRef<HTMLElement>(null!)
const detailsRef = useRef<HTMLElement>(null!)

const menuItems = localMenu.map((group) => {
return (
Expand Down
17 changes: 8 additions & 9 deletions app/routes/form.$version._index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'

import { CgCornerUpLeft } from 'react-icons/cg'
import { useEffect, useState } from 'react'
import { CgCornerUpLeft } from 'react-icons/cg/index'
import {
FaBolt,
FaBook,
Expand All @@ -9,13 +8,13 @@ import {
FaDiscord,
FaGithub,
FaTshirt,
} from 'react-icons/fa'
} from 'react-icons/fa/index'
import { json } from '@remix-run/node'
import { Link, useLoaderData, useParams } from '@remix-run/react'
import { Carbon } from '~/components/Carbon'
import { Footer } from '~/components/Footer'
import { VscPreview, VscWand } from 'react-icons/vsc'
import { TbHeartHandshake } from 'react-icons/tb'
import { VscPreview, VscWand } from 'react-icons/vsc/index'
import { TbHeartHandshake } from 'react-icons/tb/index'
import SponsorPack from '~/components/SponsorPack'
import { getBranch, gradientText, latestVersion, repo } from '~/projects/form'
import { Logo } from '~/components/Logo'
Expand Down Expand Up @@ -85,10 +84,10 @@ export default function RouteVersion() {
const { sponsors } = useLoaderData<typeof loader>()
const { version } = useParams()
const branch = getBranch(version)
const [framework, setFramework] = React.useState<Framework>('react')
const [isDark, setIsDark] = React.useState(true)
const [framework, setFramework] = useState<Framework>('react')
const [isDark, setIsDark] = useState(true)

React.useEffect(() => {
useEffect(() => {
setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)
}, [])

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { useEffect, useState } from 'react'

Check failure on line 1 in app/routes/form.$version.docs.framework.$framework.examples.$.tsx

View workflow job for this annotation

GitHub Actions / PR

'useState' is defined but never used
import type { LoaderFunctionArgs, MetaFunction } from '@remix-run/node'
import { json } from '@remix-run/node'
import { useLoaderData, useParams } from '@remix-run/react'
Expand Down Expand Up @@ -34,7 +34,7 @@

const [isDark, setIsDark] = React.useState(true)

React.useEffect(() => {
useEffect(() => {
setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)
}, [])

Expand Down
17 changes: 8 additions & 9 deletions app/routes/query.$version._index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'

import { CgCornerUpLeft } from 'react-icons/cg'
import { useEffect, useState } from 'react'
import { CgCornerUpLeft } from 'react-icons/cg/index'
import {
FaBolt,
FaBook,
Expand All @@ -9,13 +8,13 @@ import {
FaDiscord,
FaGithub,
FaTshirt,
} from 'react-icons/fa'
} from 'react-icons/fa/index'
import { json } from '@remix-run/node'
import { Link, useLoaderData, useParams } from '@remix-run/react'
import { Carbon } from '~/components/Carbon'
import { Footer } from '~/components/Footer'
import { VscPreview, VscWand } from 'react-icons/vsc'
import { TbHeartHandshake } from 'react-icons/tb'
import { VscPreview, VscWand } from 'react-icons/vsc/index'
import { TbHeartHandshake } from 'react-icons/tb/index'
import SponsorPack from '~/components/SponsorPack'
import { QueryGGBanner } from '~/components/QueryGGBanner'
import { getBranch, gradientText, latestVersion, repo } from '~/projects/query'
Expand Down Expand Up @@ -87,10 +86,10 @@ export default function RouteVersion() {
const { sponsors } = useLoaderData<typeof loader>()
const { version } = useParams()
const branch = getBranch(version)
const [framework, setFramework] = React.useState<Framework>('react')
const [isDark, setIsDark] = React.useState(true)
const [framework, setFramework] = useState<Framework>('react')
const [isDark, setIsDark] = useState(true)

React.useEffect(() => {
useEffect(() => {
setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)
}, [])

Expand Down
Loading
Loading