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

Canary #381

Merged
merged 40 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
93bc51b
chore: Package update
mwskwong May 19, 2024
f96312c
chore: Package update
mwskwong May 20, 2024
2453d86
chore: Package update
mwskwong May 20, 2024
617612e
feat: slightly update error UI
mwskwong May 21, 2024
53a6acf
fix: error fallback not returning when neon is inaccessible
mwskwong May 21, 2024
a866820
feat: update inline code UI
mwskwong May 21, 2024
929575e
feat: make use of `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` to defi…
mwskwong May 21, 2024
fa296b5
chore: Package update
mwskwong May 22, 2024
cf5de32
fix: incorrect react types dep
mwskwong May 22, 2024
a014238
refactor: rename `fetchAll` prop from `Views` to `batch`
mwskwong May 22, 2024
a26f2bb
chore: Package upgrade
mwskwong May 23, 2024
b997258
chore: Package update
mwskwong May 23, 2024
506842f
feat: use Next.js 15 RC and `next-mdx-remote` v5
mwskwong May 23, 2024
a66f698
fix: patch `@types/mdx` to support React 19
mwskwong May 23, 2024
5d186d3
fix: add back prebuild script
mwskwong May 23, 2024
674c753
chore: Package update
mwskwong May 24, 2024
5c2ae84
refactor: blog view incr handling
mwskwong May 24, 2024
4b660e1
chore: Package update
mwskwong May 24, 2024
0b55157
chore: Package update
mwskwong May 25, 2024
c49c34d
Merge branch 'canary' into feature/refactor-blog-view-incr-behavior
mwskwong May 25, 2024
2a719f3
Merge pull request #382 from mwskwong/feature/refactor-blog-view-incr…
mwskwong May 25, 2024
cdcad78
fix: wrap Suspense inside ErrorBoundary
mwskwong May 26, 2024
a14d857
chore: Package update
mwskwong May 26, 2024
d90891d
refactor: move guestbook json+ld to page component
mwskwong May 26, 2024
5c15988
feat: make use of `after()` to incr blog view
mwskwong May 26, 2024
2a08461
feat: slightly increase hero section top padding
mwskwong May 26, 2024
b5993bd
feat: use inverse color of "dark" sections
mwskwong May 26, 2024
6238f20
chore: remove prebuild script
mwskwong May 26, 2024
4a94a63
Revert "chore: remove prebuild script"
mwskwong May 26, 2024
6e35d4a
chore: Package update
mwskwong May 27, 2024
0a4af4f
Revert "feat: use inverse color of "dark" sections"
mwskwong May 27, 2024
f19ed19
Revert "Revert "chore: remove prebuild script""
mwskwong May 27, 2024
10b843d
Revert "Revert "Revert "chore: remove prebuild script"""
mwskwong May 27, 2024
8422409
chore: Package upgrade
mwskwong May 27, 2024
95a8239
chore: Package update
mwskwong May 29, 2024
9b4bf4c
chore: Package update
mwskwong May 30, 2024
df4765f
chore: Package update
mwskwong May 30, 2024
70da62f
chore: Package update
mwskwong Jun 1, 2024
5f2e524
fix: set `reply_to` field when sending email
mwskwong Jun 1, 2024
d53dfe9
ci(unlighthouse): rollback to v0.12.1 for now
mwskwong Jun 1, 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: 0 additions & 1 deletion .env

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/unlighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install -g @unlighthouse/cli puppeteer
- run: npm install -g @unlighthouse/cli@0.12.1 puppeteer
- run: npm list -g @unlighthouse/cli
- run: unlighthouse-ci --site ${{ github.event.deployment_status.environment_url }}
- uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const sharedSvgoPlugins = [
const config = {
compiler: {
emotion: true,
removeConsole: env.NODE_ENV === 'production',
},
images: {
formats: ['image/avif', 'image/webp'],
Expand Down Expand Up @@ -134,10 +133,11 @@ const config = {
],
logging: { fetches: { fullUrl: true } },
experimental: {
reactCompiler: false, // disabling for now since watch() from React Hook Form isn't returning the updated form value
ppr: true,
after: true,
webpackBuildWorker: true,
optimizePackageImports: ['@mui/joy'],
// reactCompiler: true, // disabling for now since watch() from React Hook Form isn't returning the updated form value
},
};

Expand Down
3,660 changes: 1,487 additions & 2,173 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@hookform/resolvers": "^3.4.0",
"@hookform/resolvers": "^3.4.2",
"@icons-pack/react-simple-icons": "^9.5.0",
"@mui/base": "next",
"@mui/joy": "next",
Expand All @@ -37,37 +37,37 @@
"@react-email/text": "^0.0.8",
"@t3-oss/env-core": "^0.10.1",
"@t3-oss/env-nextjs": "^0.10.1",
"@vercel/analytics": "^1.2.2",
"@vercel/speed-insights": "^1.0.10",
"contentful": "^10.11.0",
"@vercel/analytics": "^1.3.1",
"@vercel/speed-insights": "^1.0.11",
"contentful": "^10.11.7",
"dedent": "^1.5.3",
"feed": "^4.2.2",
"geist": "^1.3.0",
"lodash-es": "^4.17.21",
"lucide-react": "^0.378.0",
"merge-sx": "^2.0.1",
"next": "canary",
"next-mdx-remote": "^4.4.1",
"react": "beta",
"react-dom": "beta",
"react-email": "^2.1.2",
"react-hook-form": "^7.51.4",
"lucide-react": "^0.381.0",
"merge-sx": "^2.0.2",
"next": "rc",
"next-mdx-remote": "^5.0.0",
"react": "rc",
"react-dom": "rc",
"react-email": "^2.1.4",
"react-hook-form": "^7.51.5",
"rehype-pretty-code": "^0.13.2",
"rehype-slug": "^6.0.0",
"resend": "^3.2.0",
"schema-dts": "^1.1.2",
"server-only": "^0.0.1",
"shiki": "^1.5.2",
"shiki": "^1.6.1",
"zod": "^3.23.8"
},
"devDependencies": {
"@next/bundle-analyzer": "canary",
"@next/eslint-plugin-next": "canary",
"@next/bundle-analyzer": "rc",
"@next/eslint-plugin-next": "rc",
"@svgr/webpack": "^8.1.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.12.12",
"@types/react": "npm:types-react@beta",
"@types/react-dom": "npm:types-react-dom@beta",
"@types/node": "^20.13.0",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc",
"@vercel/style-guide": "^6.0.0",
"babel-plugin-react-compiler": "latest",
"dotenv-cli": "^7.4.2",
Expand All @@ -77,12 +77,12 @@
"prettier": "^3.2.5",
"prettier-plugin-prisma": "^5.0.0",
"prisma": "^5.14.0",
"type-fest": "^4.18.2",
"type-fest": "^4.18.3",
"typescript": "^5.4.5"
},
"overrides": {
"@react-email/render": "canary",
"@types/react": "npm:types-react@beta",
"@types/react-dom": "npm:types-react-dom@beta"
"@react-email/render": "^0.0.15",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc"
}
}
22 changes: 5 additions & 17 deletions patches/@types+mdx+2.0.13.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
diff --git a/node_modules/@types/mdx/types.d.ts b/node_modules/@types/mdx/types.d.ts
index 498bb69..bc30ce1 100644
index 498bb69..030a05f 100644
--- a/node_modules/@types/mdx/types.d.ts
+++ b/node_modules/@types/mdx/types.d.ts
@@ -20,7 +20,7 @@ type ClassElementType = Extract<ElementType, new(props: Record<string, any>) =>
/**
* A valid JSX string component.
*/
-type StringComponent = Extract<keyof JSX.IntrinsicElements, ElementType extends never ? string : ElementType>;
+type StringComponent = Extract<keyof React.JSX.IntrinsicElements, ElementType extends never ? string : ElementType>;
@@ -1,3 +1,5 @@
+import { type JSX } from 'react'
+
// Internal helper types

/**
* A JSX element returned by MDX content.
@@ -70,7 +70,7 @@ interface NestedMDXComponents {
export type MDXComponents =
& NestedMDXComponents
& {
- [Key in StringComponent]?: Component<JSX.IntrinsicElements[Key]>;
+ [Key in StringComponent]?: Component<React.JSX.IntrinsicElements[Key]>;
}
& {
/**
16 changes: 0 additions & 16 deletions patches/next+14.3.0-canary.68.patch

This file was deleted.

27 changes: 23 additions & 4 deletions src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { type Metadata } from 'next';
import NextLink from 'next/link';
import { notFound } from 'next/navigation';
import { unstable_after as after } from 'next/server';
import { type FC, Suspense } from 'react';
import { type BlogPosting, type BreadcrumbList, type Graph } from 'schema-dts';

Expand All @@ -27,6 +28,7 @@ import { SectionDivider } from '@/components/section-divider';
import { firstName, headline, lastName } from '@/constants/content';
import { blog as blogNav, blogRssFeed, home } from '@/constants/nav';
import { env } from '@/env.mjs';
import { prisma } from '@/lib/clients';
import { getPerson } from '@/lib/json-ld';
import {
getBlogBySlug,
Expand All @@ -43,6 +45,18 @@ interface BlogProps {
params: { slug: string };
}

const IncrBlogView: FC<{ blogId: string }> = ({ blogId }) => {
after(
prisma.blogMetadata.upsert({
where: { id: blogId },
update: { view: { increment: 1 } },
create: { id: blogId },
}),
);

return null;
};

const Blog: FC<BlogProps> = async ({ params: { slug } }) => {
const [blog, personalPhoto, socialMediaProfiles, person] = await Promise.all([
getBlogBySlug(slug),
Expand All @@ -54,6 +68,11 @@ const Blog: FC<BlogProps> = async ({ params: { slug } }) => {

return (
<>
<ErrorBoundary>
<Suspense>
<IncrBlogView blogId={blog.id} />
</Suspense>
</ErrorBoundary>
<main>
<Container
component="article"
Expand Down Expand Up @@ -82,11 +101,11 @@ const Blog: FC<BlogProps> = async ({ params: { slug } }) => {
spacing={1}
sx={{ alignItems: 'center', justifyContent: 'space-around' }}
>
<Suspense fallback={<ViewsSkeleton sx={{ mx: 0.75 }} />}>
<ErrorBoundary fallback={<ViewsError sx={{ mx: 0.75 }} />}>
<ErrorBoundary fallback={<ViewsError sx={{ mx: 0.75 }} />}>
<Suspense fallback={<ViewsSkeleton sx={{ mx: 0.75 }} />}>
<Views blogId={blog.id} sx={{ mx: 0.75 }} />
</ErrorBoundary>
</Suspense>
</Suspense>
</ErrorBoundary>
<CopyUrlButton />
<ShareDropdown blog={blog} />
</Stack>
Expand Down
20 changes: 7 additions & 13 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,15 @@ const Blogs: FC = async () => {
{dateFormatter.format(new Date(createdAt))}
</Typography>
<Divider orientation="vertical" />
<Suspense
fallback={<ViewsSkeleton hideIcon level="body-sm" />}
<ErrorBoundary
fallback={<ViewsError hideIcon level="body-sm" />}
>
<ErrorBoundary
fallback={<ViewsError hideIcon level="body-sm" />}
<Suspense
fallback={<ViewsSkeleton hideIcon level="body-sm" />}
>
<Views
fetchAll
hideIcon
readOnly
blogId={id}
level="body-sm"
/>
</ErrorBoundary>
</Suspense>
<Views batch hideIcon blogId={id} level="body-sm" />
</Suspense>
</ErrorBoundary>
</CardContent>
</Card>
</Grid>
Expand Down
81 changes: 0 additions & 81 deletions src/app/guestbook/json-ld.tsx

This file was deleted.

Loading