Skip to content

Commit 1979cfa

Browse files
committed
update deps
1 parent e82f009 commit 1979cfa

File tree

10 files changed

+615
-222
lines changed

10 files changed

+615
-222
lines changed

.gitignore

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,26 @@
44
.vercel
55
package-lock.json
66
yarn.lock
7-
yarn-error.log
7+
yarn-error.log
8+
9+
# misc
10+
dump.rdb
11+
.DS_Store
12+
*.pem
13+
.vscode
14+
15+
# debug
16+
npm-debug.log*
17+
yarn-debug.log*
18+
yarn-error.log*
19+
.pnpm-debug.log*
20+
21+
# local env files
22+
.env*.local
23+
24+
# vercel
25+
.vercel
26+
27+
# typescript
28+
*.tsbuildinfo
29+
next-env.d.ts

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

next.config.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
module.exports = {
1+
module.exports = require('next-plugin-preact')({
22
experimental: {
3-
legacyBrowsers: false,
4-
browsersListForSwc: true
5-
},
6-
webpack: (config, { dev, isServer }) => {
7-
if (!dev && !isServer) {
8-
Object.assign(config.resolve.alias, {
9-
react: 'preact/compat',
10-
'react-dom/test-utils': 'preact/test-utils',
11-
'react-dom': 'preact/compat'
12-
});
13-
}
14-
15-
return config;
3+
esmExternals: false
164
}
17-
};
5+
});

package.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "next",
77
"build": "next build",
88
"start": "node server.js",
9-
"pretty": "prettier --write --tab-width 2 \"**/*.js\""
9+
"pretty": "prettier --write --tab-width 2 \"**/*.js\"",
10+
"postinstall": "patch-package"
1011
},
1112
"lint-staged": {
1213
"*.js": [
@@ -19,20 +20,24 @@
1920
}
2021
},
2122
"dependencies": {
22-
"@reduxjs/toolkit": "^1.8.6",
23+
"@reduxjs/toolkit": "^2.3.0",
2324
"@sentry/browser": "5.22.3",
2425
"@sentry/node": "^5.22.3",
2526
"compression": "^1.7.4",
2627
"cookie-parser": "^1.4.5",
2728
"dotenv": "^8.2.0",
2829
"express": "^4.18.2",
2930
"isomorphic-unfetch": "^3.0.0",
30-
"next": "12.1.5",
31+
"next": "14.2.13",
32+
"next-plugin-preact": "^3.0.7",
3133
"next-runtime-dotenv": "^1.3.0",
32-
"preact": "^10.11.1",
33-
"react": "18.2.0",
34-
"react-dom": "18.2.0",
34+
"patch-package": "^8.0.0",
35+
"preact": "10.24.1",
36+
"preact-render-to-string": "^6.5.11",
37+
"react": "npm:@preact/compat@^18.3.1",
38+
"react-dom": "npm:@preact/compat@^18.3.1",
3539
"react-redux": "7.2.4",
40+
"react-ssr-prepass": "npm:preact-ssr-prepass@^1.2.2",
3641
"redux": "4.0.5",
3742
"redux-thunk": "^2.3.0",
3843
"sass": "^1.26.10"
@@ -53,7 +58,7 @@
5358
"prettier": "^2.7.1",
5459
"redux-logger": "^3.0.6",
5560
"tailwindcss": "^3.1.8",
56-
"typescript": "^4.8.4"
61+
"typescript": "^5.4.5"
5762
},
5863
"engines": {
5964
"node": ">=16"

pages/index.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,32 @@ import { getPosts } from 'api/posts';
55
import Post from 'components/Post';
66
import type { IPost } from 'types/IPost';
77

8-
interface PageProps {
8+
type PageProps = {
99
posts: IPost[];
10-
}
10+
};
1111

1212
export const getServerSideProps: GetServerSideProps = async () => {
1313
const posts = await getPosts();
14+
1415
return {
1516
props: {
1617
posts
1718
}
1819
};
1920
};
2021

21-
const IndexPage: NextPage<PageProps> = ({ posts }) => (
22-
<Layout>
23-
<ul>
24-
{posts.map((p) => (
25-
<Post key={p.title} post={p} />
26-
))}
27-
</ul>
28-
</Layout>
29-
);
22+
const IndexPage = (props: PageProps) => {
23+
const { posts } = props;
24+
25+
return (
26+
<Layout>
27+
<ul>
28+
{posts.map((p) => (
29+
<Post key={p.title} post={p} />
30+
))}
31+
</ul>
32+
</Layout>
33+
);
34+
};
3035

3136
export default IndexPage;

patches/preact+10.24.1.patch

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff --git a/node_modules/preact/compat/server.js b/node_modules/preact/compat/server.js
2+
index 3eaf720..3231a4e 100644
3+
--- a/node_modules/preact/compat/server.js
4+
+++ b/node_modules/preact/compat/server.js
5+
@@ -19,8 +19,19 @@ try {
6+
);
7+
}
8+
9+
+var renderToReadableStream;
10+
+try {
11+
+ const mod = require('preact-render-to-string/stream');
12+
+ renderToReadableStream = mod.default || mod.renderToReadableStream || mod;
13+
+} catch (e) {
14+
+ throw Error(
15+
+ 'renderToReadableStream() error: update "preact-render-to-string" dependency to at least 6.5.0.'
16+
+ );
17+
+}
18+
+
19+
module.exports = {
20+
renderToString: renderToString,
21+
renderToStaticMarkup: renderToString,
22+
- renderToPipeableStream: renderToPipeableStream
23+
+ renderToPipeableStream: renderToPipeableStream,
24+
+ renderToReadableStream
25+
};
26+
diff --git a/node_modules/preact/package.json b/node_modules/preact/package.json
27+
index d20d488..98ce468 100644
28+
--- a/node_modules/preact/package.json
29+
+++ b/node_modules/preact/package.json
30+
@@ -76,6 +76,11 @@
31+
"import": "./compat/server.mjs",
32+
"require": "./compat/server.js"
33+
},
34+
+ "./compat/server.browser": {
35+
+ "browser": "./compat/server.browser.js",
36+
+ "import": "./compat/server.mjs",
37+
+ "require": "./compat/server.js"
38+
+ },
39+
"./compat/jsx-runtime": {
40+
"types": "./jsx-runtime/src/index.d.ts",
41+
"import": "./compat/jsx-runtime.mjs",

src/components/Nav/index.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import React from 'react';
21
import Image from 'next/image';
32
import Link from 'next/link';
43
import nextLogo from 'assets/nextjs.svg';
5-
import s from './styles.module.scss';
4+
import styles from './styles.module.scss';
65

7-
const Nav: React.FC = () => (
8-
<div className={s.nav}>
6+
const Nav = () => (
7+
<div className={styles.nav}>
98
<Link href="/">
10-
<a>
11-
<Image src={nextLogo} alt="nextjs" width="100" height="40" />
12-
</a>
9+
<Image src={nextLogo} alt="nextjs" width="100" height="40" />
1310
</Link>
14-
<Link href="/counter">
15-
<a className="font-normal text-gray-600 dark:text-gray-400 hidden md:inline-block p-1 sm:px-3 sm:py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all">
16-
Counter
17-
</a>
11+
<Link
12+
href="/counter"
13+
className="font-normal text-gray-600 dark:text-gray-400 hidden md:inline-block p-1 sm:px-3 sm:py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all"
14+
>
15+
Counter
1816
</Link>
1917
|
20-
<Link href="/about">
21-
<a className="font-normal text-gray-600 dark:text-gray-400 hidden md:inline-block p-1 sm:px-3 sm:py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all">
22-
About
23-
</a>
18+
<Link
19+
href="/about"
20+
className="font-normal text-gray-600 dark:text-gray-400 hidden md:inline-block p-1 sm:px-3 sm:py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all"
21+
>
22+
About
2423
</Link>
2524
|
26-
<Link href="/contact">
27-
<a className="font-normal text-gray-600 dark:text-gray-400 hidden md:inline-block p-1 sm:px-3 sm:py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all">
28-
Contact
29-
</a>
25+
<Link
26+
href="/contact"
27+
className="font-normal text-gray-600 dark:text-gray-400 hidden md:inline-block p-1 sm:px-3 sm:py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all"
28+
>
29+
Contact
3030
</Link>
3131
</div>
3232
);

src/components/Post/index.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@ import Link from 'next/link';
33
import styles from './Post.module.scss';
44
import type { IPost } from 'types/IPost';
55

6-
interface PageProps {
6+
type PageProps = {
77
post: IPost;
8-
}
8+
};
99

10-
const Post: React.FC<PageProps> = ({ post }) => (
11-
<div className={styles.post}>
12-
<Link href={`/post/[id]?id=${post.title}`} as={`/post/${post.title}`}>
13-
<a>
10+
const Post = (props: PageProps) => {
11+
const { post } = props;
12+
13+
return (
14+
<div className={styles.post}>
15+
<Link href={`/post/[id]?id=${post.title}`} as={`/post/${post.title}`}>
1416
<h3>{post.title}</h3>
1517
<p>{post.body}</p>
16-
</a>
17-
</Link>
18-
</div>
19-
);
18+
</Link>
19+
</div>
20+
);
21+
};
2022

2123
export default Post;

src/layouts/Main.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
import React from 'react';
1+
import { ReactNode } from 'react';
22
import Head from 'next/head';
33
import Nav from 'components/Nav';
4-
import s from './styles.module.scss';
4+
import styles from './styles.module.scss';
55

6-
interface IProps {
7-
children: React.ReactNode;
6+
type MainLayoutProps = {
7+
children: ReactNode;
88
title?: string;
9-
}
9+
};
1010

11-
const MainLayout: React.FC<IProps> = ({
12-
children,
13-
title = 'default title'
14-
}) => (
15-
<div className={s.layout}>
11+
const MainLayout = ({ children, title = 'default title' }: MainLayoutProps) => (
12+
<div className={styles.layout}>
1613
<Head>
1714
<title>{title}</title>
1815
</Head>

0 commit comments

Comments
 (0)