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

merge dev into main #4598

Merged
merged 4 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const securityHeaders = [
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
];

/**
Expand All @@ -66,7 +70,6 @@ const nextConfig = {
// Force SWC transform on build to stop Next.js trying to use babel
// since babel is only needed to support vanilla-extract in unit tests
forceSwcTransforms: true,
serverComponentsExternalPackages: ['shiki'],
},
images: {
minimumCacheTTL: 120,
Expand Down
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"@fontsource/poppins": "^5.1.0",
"@lukemorales/query-key-factory": "^1.3.4",
"@mdx-js/mdx": "^3.1.0",
"@next/eslint-plugin-next": "^14.2.20",
"@next/mdx": "^15.0.3",
"@next/third-parties": "^14.2.20",
"@next/eslint-plugin-next": "15.0.4",
"@next/mdx": "15.0.4",
"@next/third-parties": "15.0.4",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/auto-instrumentations-node": "^0.53.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.55.0",
Expand Down Expand Up @@ -82,7 +82,7 @@
"million": "^3.1.11",
"motion": "^10.18.0",
"nanoid": "^5.0.8",
"next": "^14.2.20",
"next": "15.0.4",
"next-mdx-remote": "^5.0.0",
"next-sanity": "9.8.10",
"next-seo": "^6.6.0",
Expand All @@ -93,9 +93,9 @@
"pino": "^9.5.0",
"prism-react-renderer": "^2.4.0",
"prom-client": "^15.1.3",
"react": "^18.3.1",
"react": "19.0.0",
"react-children-utilities": "^2.10.0",
"react-dom": "^18.3.1",
"react-dom": "19.0.0",
"react-feather": "^2.0.10",
"react-ga4": "^2.1.0",
"react-icons": "5.2.1",
Expand Down Expand Up @@ -136,7 +136,7 @@
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@next/env": "^14.2.20",
"@next/env": "15.0.4",
"@playwright/test": "^1.48.2",
"@shikijs/rehype": "^1.23.0",
"@svgr/webpack": "^8.1.0",
Expand All @@ -153,7 +153,7 @@
"@types/lodash": "^4.17.13",
"@types/node": "20.14.10",
"@types/nprogress": "^0.2.3",
"@types/react": "18.3.12",
"@types/react": "19.0.1",
"@types/rss": "^0.0.32",
"@typescript-eslint/eslint-plugin": "8.12.2",
"@typescript-eslint/parser": "8.12.2",
Expand All @@ -164,7 +164,7 @@
"cz-conventional-changelog": "^3.3.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^14.2.18",
"eslint-config-next": "15.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
Expand Down Expand Up @@ -215,5 +215,10 @@
"hooks": {
"prepare-commit-msg": "exec < /dev/tty && npx cz --hook || true"
}
},
"pnpm": {
"overrides": {
"@types/react": "19.0.1"
}
}
}
1,715 changes: 845 additions & 870 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/api/disable-draft/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export async function GET(request: Request) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { searchParams } = new URL(request.url);

const draft = draftMode();
const draft = await draftMode();

draft.disable();

Expand Down
2 changes: 1 addition & 1 deletion src/app/api/draft/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function GET(request: Request) {
});
}

const draft = draftMode();
const draft = await draftMode();

draft.enable();

Expand Down
14 changes: 7 additions & 7 deletions src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Meta from '@frontend/components/Meta';
import Page from '@frontend/components/Page';
import Spacer from '@frontend/components/Spacer';
import Text from '@frontend/components/Text';
import siteConfig from '@frontend/config/site';
import imageService from '@frontend/services/imageService';
import postService from '@frontend/services/postService';
import * as utils from '@frontend/styles/util.css';
Expand All @@ -17,18 +16,18 @@ import Image from 'next/image';
import Link from 'next/link';
import { notFound } from 'next/navigation';

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

interface Props {
params: {
params: Promise<{
slug: string;
};
}>;
}

export default async function PostPage({ params }: Props) {
const { slug } = params;
const { slug } = await params;

const { isEnabled } = draftMode();
const { isEnabled } = await draftMode();

const post = await postService.getPost(slug, isEnabled);

Expand Down Expand Up @@ -119,7 +118,8 @@ export async function generateStaticParams() {
}));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params;
const { slug } = params;

const post = await postService.getPost(slug, false);
Expand Down
3 changes: 1 addition & 2 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import Page from '@frontend/components/Page';
import PostItem from '@frontend/components/PostItem';
import Spacer from '@frontend/components/Spacer';
import Text from '@frontend/components/Text';
import siteConfig from '@frontend/config/site';
import postService from '@frontend/services/postService';
import { Post } from '@frontend/types/sanity';
import { Metadata } from 'next';

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

export const metadata: Metadata = {
title: 'Blog',
Expand Down
9 changes: 4 additions & 5 deletions src/app/blog/tags/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ import Heading from '@frontend/components/Heading';
import Page from '@frontend/components/Page';
import PostItem from '@frontend/components/PostItem';
import Spacer from '@frontend/components/Spacer';
import siteConfig from '@frontend/config/site';
import postService from '@frontend/services/postService';
import { Post } from '@frontend/types/sanity';

interface Props {
params: {
params: Promise<{
slug: string;
};
}>;
}

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

export default async function TagPage({ params }: Props) {
const { slug } = params;
const { slug } = await params;

const posts = await postService.getAllPosts();

Expand Down
3 changes: 1 addition & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import Page from '@frontend/components/Page';
import PostItem from '@frontend/components/PostItem';
import Spacer from '@frontend/components/Spacer';
import Text from '@frontend/components/Text';
import siteConfig from '@frontend/config/site';
import postService from '@frontend/services/postService';
import workService from '@frontend/services/workService';
import { Metadata } from 'next';
import dynamic from 'next/dynamic';

const WorkItem = dynamic(() => import('@frontend/components/WorkItem'));

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

export const metadata: Metadata = {
title: 'Home | lhowsam.com',
Expand Down
14 changes: 7 additions & 7 deletions src/app/projects/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Meta from '@frontend/components/Meta';
import Page from '@frontend/components/Page';
import Spacer from '@frontend/components/Spacer';
import Text from '@frontend/components/Text';
import siteConfig from '@frontend/config/site';
import imageService from '@frontend/services/imageService';
import projectService from '@frontend/services/projectService';
import * as utils from '@frontend/styles/util.css';
Expand All @@ -18,16 +17,16 @@ import { notFound } from 'next/navigation';
import { FiGithub } from 'react-icons/fi';

interface Props {
params: {
params: Promise<{
slug: string;
};
}>;
}

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

export default async function ProjectPage({ params }: Props) {
const { slug } = params;
const { isEnabled } = draftMode();
const { slug } = await params;
const { isEnabled } = await draftMode();

const project = await projectService.getProject(slug, isEnabled);

Expand Down Expand Up @@ -110,7 +109,8 @@ export async function generateStaticParams() {
}));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params;
const { slug } = params;

const project = await projectService.getProject(slug);
Expand Down
3 changes: 1 addition & 2 deletions src/app/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import * as List from '@frontend/components/List';
import Page from '@frontend/components/Page';
import ProjectItem from '@frontend/components/ProjectItem';
import Text from '@frontend/components/Text';
import siteConfig from '@frontend/config/site';
import projectService from '@frontend/services/projectService';
import { Metadata } from 'next';

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

export const metadata: Metadata = {
title: 'Projects',
Expand Down
14 changes: 7 additions & 7 deletions src/app/work/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ import Meta from '@frontend/components/Meta';
import Page from '@frontend/components/Page';
import Spacer from '@frontend/components/Spacer';
import Text from '@frontend/components/Text';
import siteConfig from '@frontend/config/site';
import imageService from '@frontend/services/imageService';
import workService from '@frontend/services/workService';
import { Metadata } from 'next';
import { draftMode } from 'next/headers';
import { notFound } from 'next/navigation';

interface Props {
params: {
params: Promise<{
slug: string;
};
}>;
}

export const revalidate = siteConfig.defaultRevalidate;
export const revalidate = 1800;

export default async function WorkSlugPage({ params }: Props) {
const { slug } = params;
const { isEnabled } = draftMode();
const { slug } = await params;
const { isEnabled } = await draftMode();

const work = await workService.getWork(slug, isEnabled);

Expand Down Expand Up @@ -74,7 +73,8 @@ export async function generateStaticParams() {
}));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
export async function generateMetadata(props: Props): Promise<Metadata> {
const params = await props.params;
const { slug } = params;

const work = await workService.getWork(slug);
Expand Down
1 change: 1 addition & 0 deletions src/components/CommandMenu/CommandMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import baseRender from '@frontend/test/render';
import { ToastProvider as RadixToastProvider } from '@radix-ui/react-toast';
import { TooltipProvider as RadixTooltipProvider } from '@radix-ui/react-tooltip';
import { fireEvent, screen, within } from '@testing-library/react';
import type { JSX } from 'react';
import CommandMenu from '.';

function render(ui: JSX.Element) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/CommandMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const CommandItem = ({ children, value, onSelect }: CommandItemProps) => {
<LazyMotion features={domAnimation}>
<motion.span
layoutId="highlight"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
className="highlight"
transition={{
duration: 0.2,
Expand Down
1 change: 1 addition & 0 deletions src/components/SocialShare/SocialShare.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TooltipProvider as RadixTooltipProvider } from '@radix-ui/react-tooltip
import { fireEvent, screen } from '@testing-library/react';
import { usePathname } from 'next/navigation';
import { MemoryRouterProvider } from 'next-router-mock/MemoryRouterProvider';
import type { JSX } from 'react';
import SocialShare from '.';

function render(ui: JSX.Element) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/sanity/CustomMarkdownInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// CustomMarkdownInput.tsx
import { useMemo } from 'react';
import { useMemo, type JSX } from 'react';
import { MarkdownInput, MarkdownInputProps } from 'sanity-plugin-markdown';

export default function CustomMarkdownInput(
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDebouncedCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function useDebouncedCallback<Args extends unknown[] = []>(
callback: (...args: Args) => void,
timeout = 0,
): UseDebouncedCallbackReturn<Args> {
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
const timeoutRef = useRef<ReturnType<typeof setTimeout>>(undefined);
const callbackRef = useRef(callback);
const mountedRef = useMountedRef();

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useInterval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function useInterval(
const savedCallback = useRef<() => void>(callback);
savedCallback.current = callback;

const interval = useRef<NodeJS.Timeout>();
const interval = useRef<NodeJS.Timeout>(undefined);

const cancelInterval = useCallback(() => {
if (interval.current) {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useMountedRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RefObject, useEffect, useRef } from 'react';
* component is currently mounted or not.
*/

export default function useMountedRef(): RefObject<boolean> {
export default function useMountedRef(): RefObject<boolean | null> {
const isMountedRef = useRef(false);

useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/test/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const DefaultWrapper = ({ children }: { children?: ReactNode }) => {
* that would otherwise create unnecessary boilerplate.
*/
export default function render(
ui: ReactElement,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ui: ReactElement<any>,
options?: Omit<RenderOptions, 'queries'>,
): CustomRenderResult {
return {
Expand Down
1 change: 1 addition & 0 deletions src/types/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ComponentPropsWithoutRef,
ElementType,
JSXElementConstructor,
type JSX,
} from 'react';

// Source: https://github.com/emotion-js/emotion/blob/master/packages/styled-base/types/helper.d.ts
Expand Down
Loading