Skip to content

Commit 9e64865

Browse files
committed
feat: upgrade nextjs
Signed-off-by: Innei <[email protected]>
1 parent 352d020 commit 9e64865

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+4484
-4040
lines changed

.eslintrc.cjs

-15
This file was deleted.

eslint.config.mjs

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// @ts-check
2+
import { defineConfig } from 'eslint-config-hyoban'
3+
4+
export default defineConfig(
5+
{
6+
formatting: false,
7+
lessOpinionated: true,
8+
ignores: [],
9+
preferESM: false,
10+
react: 'next',
11+
tailwindCSS: true,
12+
},
13+
{
14+
settings: {
15+
tailwindcss: {
16+
whitelist: ['center'],
17+
},
18+
},
19+
rules: {
20+
'package-json/valid-package-def': 'off',
21+
'@eslint-react/no-missing-key': 'warn',
22+
'no-restricted-syntax': 'off',
23+
'import/no-anonymous-default-export': 'off',
24+
eqeqeq: 'warn',
25+
'no-console': 'warn',
26+
'@eslint-react/dom/no-missing-button-type': 0,
27+
'unicorn/prefer-math-trunc': 'off',
28+
'unicorn/prefer-dom-node-remove': 'off',
29+
'@typescript-eslint/no-unsafe-function-type': 'off',
30+
'no-empty': 'off',
31+
'@typescript-eslint/no-empty-object-type': 'warn',
32+
'unicorn/prefer-query-selector': 0,
33+
'regexp/no-super-linear-backtracking': 0,
34+
'regexp/no-useless-assertions': 0,
35+
'unicorn/no-new-array': 0,
36+
'@typescript-eslint/method-signature-style': 0,
37+
'unicorn/prefer-code-point': 'warn',
38+
'unicorn/no-object-as-default-parameter': 'warn',
39+
'unused-imports/no-unused-vars': 'warn',
40+
'@eslint-react/no-unstable-default-props': 'warn',
41+
'unicorn/prefer-regexp-test': 'warn',
42+
'no-unsafe-optional-chaining': 'warn',
43+
'unicorn/prefer-logical-operator-over-ternary': 'warn',
44+
'arrow-body-style': 0,
45+
'unicorn/no-array-callback-reference': 0,
46+
'prefer-regex-literals': 0,
47+
'regexp/optimal-quantifier-concatenation': 'warn',
48+
'unicorn/prefer-string-slice': 0,
49+
'array-callback-return': 0,
50+
'regexp/no-unused-capturing-group': 1,
51+
'unicorn/no-anonymous-default-export': 0,
52+
'unicorn/no-magic-array-flat-depth': 1,
53+
'react-refresh/only-export-components': 0,
54+
'@eslint-react/no-clone-element': 0,
55+
},
56+
},
57+
)

markdown/index.json

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
{
1010
"paths": [
1111
"custom-component.md",
12-
"draw.md",
1312
"highlight.md",
1413
"markdown.md"
1514
],

markdown/sections/usage/draw.md

-27
This file was deleted.

next.config.mjs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { bootstarp } from './plugins/json-watcher.mjs'
22

3-
bootstarp()
3+
if (process.env.NODE_ENV === 'development') {
4+
bootstarp()
5+
}
46

57
/** @type {import('next').NextConfig} */
68
const nextConfig = {
79
output: process.env.NODE_ENV === 'production' ? 'export' : 'standalone',
8-
10+
eslint: {
11+
ignoreDuringBuilds: true,
12+
},
913
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
1014
config.plugins.push(
1115
new webpack.optimize.MinChunkSizePlugin({

package.json

+55-54
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,98 @@
11
{
22
"name": "book-ssg-template",
3-
"repository": {
4-
"url": "https://github.com/Innei/book-ssg-template"
5-
},
63
"version": "0.1.0",
74
"private": true,
5+
"packageManager": "[email protected]+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee",
86
"license": "MIT",
7+
"repository": {
8+
"url": "https://github.com/Innei/book-ssg-template"
9+
},
910
"scripts": {
10-
"prepare": "pnpm exec simple-git-hooks",
11-
"dev": "next dev -p 9988",
1211
"build": "next build",
13-
"start": "next start",
14-
"lint": "next lint"
15-
},
16-
"bump": {
17-
"before": [
18-
"git pull --rebase",
19-
"ni"
20-
],
21-
"changelog": true
22-
},
23-
"simple-git-hooks": {
24-
"pre-commit": "pnpm exec lint-staged"
25-
},
26-
"lint-staged": {
27-
"*.{js,jsx,ts,tsx}": [
28-
"eslint --cache --fix",
29-
"prettier --ignore-path ./.gitignore --write "
30-
]
12+
"dev": "next dev -p 9988",
13+
"lint": "eslint --fix",
14+
"prepare": "pnpm exec simple-git-hooks",
15+
"start": "next start"
3116
},
3217
"dependencies": {
33-
"@codesandbox/sandpack-react": "2.18.3",
34-
"@excalidraw/excalidraw": "0.17.6",
35-
"@floating-ui/react-dom": "2.1.1",
36-
"@radix-ui/react-dialog": "1.1.1",
37-
"@radix-ui/react-tabs": "1.1.0",
18+
"@codesandbox/sandpack-react": "2.19.9",
19+
"@floating-ui/react-dom": "2.1.2",
20+
"@radix-ui/react-dialog": "1.1.2",
21+
"@radix-ui/react-tabs": "1.1.1",
3822
"@types/katex": "0.16.7",
3923
"camelcase-keys": "9.1.3",
40-
"chokidar": "^3.6.0",
24+
"chokidar": "^4.0.1",
4125
"clsx": "2.1.1",
4226
"colorjs.io": "0.5.2",
4327
"devtools-detector": "2.0.22",
44-
"foxact": "0.2.38",
45-
"framer-motion": "11.3.31",
28+
"foxact": "0.2.41",
29+
"framer-motion": "11.11.11",
4630
"globby": "^14.0.2",
4731
"immer": "10.1.1",
48-
"jotai": "2.9.3",
32+
"jotai": "2.10.1",
4933
"js-yaml": "4.1.0",
5034
"katex": "0.16.11",
35+
"lodash": "4.17.21",
5136
"markdown-to-jsx": "npm:@innei/[email protected]",
5237
"medium-zoom": "1.1.0",
53-
"mermaid": "10.9.1",
54-
"next": "14.2.9",
55-
"next-seo": "6.5.0",
38+
"mermaid": "11.4.0",
39+
"next": "15.0.2",
40+
"next-seo": "6.6.0",
5641
"next-themes": "0.3.0",
57-
"rc-modal-sheet": "0.3.1",
58-
"react": "^18.3.1",
59-
"react-dom": "^18.3.1",
42+
"rc-modal-sheet": "0.3.2",
43+
"react": "19.0.0-rc-7c8e5e7a-20241101",
44+
"react-dom": "19.0.0-rc-7c8e5e7a-20241101",
6045
"react-intersection-observer": "9.13.1",
6146
"remark": "15.0.1",
6247
"remark-parse": "11.0.0",
63-
"shiki": "1.13.0",
48+
"shiki": "1.22.2",
6449
"swr": "2.2.5",
65-
"tailwind-merge": "2.5.2",
50+
"tailwind-merge": "2.5.4",
6651
"unified": "11.0.5",
6752
"unist-util-visit": "5.0.0",
68-
"vaul": "0.9.2"
53+
"vaul": "1.1.1"
6954
},
7055
"devDependencies": {
71-
"@iconify-json/mingcute": "1.1.20",
56+
"@iconify-json/mingcute": "1.2.1",
7257
"@iconify/tailwind": "1.1.3",
73-
"@innei/eslint-config-react-ts": "0.15.0",
7458
"@innei/prettier": "0.15.0",
75-
"@shikijs/transformers": "1.13.0",
59+
"@shikijs/transformers": "1.22.2",
7660
"@tailwindcss/typography": "0.5.15",
7761
"@types/js-yaml": "4.0.9",
78-
"@types/node": "^20.15.0",
79-
"@types/react": "^18.3.5",
80-
"@types/react-dom": "^18.3.0",
62+
"@types/node": "^22.8.7",
63+
"@types/react": "^18.3.12",
64+
"@types/react-dom": "^18.3.1",
8165
"autoprefixer": "^10.4.20",
82-
"daisyui": "4.12.10",
83-
"eslint": "8.57.0",
66+
"daisyui": "4.12.14",
67+
"eslint": "9.14.0",
68+
"eslint-config-hyoban": "3.1.12",
8469
"lint-staged": "15.2.10",
8570
"postcss-import": "16.1.0",
86-
"postcss-nested": "6.2.0",
87-
"postcss-preset-env": "9.6.0",
71+
"postcss-nested": "7.0.2",
72+
"postcss-preset-env": "10.0.9",
8873
"postcss-prune-var": "1.1.2",
8974
"prettier": "3.3.3",
90-
"rimraf": "5.0.10",
75+
"rimraf": "6.0.1",
9176
"simple-git-hooks": "2.11.1",
9277
"tailwind-scrollbar": "3.1.0",
9378
"tailwind-variants": "0.2.1",
94-
"tailwindcss": "^3.4.10",
95-
"typescript": "5.5.4"
79+
"tailwindcss": "^3.4.14",
80+
"typescript": "5.6.3"
81+
},
82+
"simple-git-hooks": {
83+
"pre-commit": "pnpm exec lint-staged"
84+
},
85+
"lint-staged": {
86+
"*.{js,jsx,ts,tsx}": [
87+
"eslint --fix",
88+
"prettier --ignore-path ./.gitignore --write "
89+
]
90+
},
91+
"bump": {
92+
"before": [
93+
"git pull --rebase",
94+
"ni"
95+
],
96+
"changelog": true
9697
}
9798
}

plugins/json-watcher.mjs

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import { existsSync, writeFileSync } from 'fs'
2-
import { readFile } from 'fs/promises'
3-
import path from 'path'
4-
import { fileURLToPath } from 'url'
1+
/* eslint-disable unicorn/no-this-assignment */
2+
import { existsSync, writeFileSync } from 'node:fs'
3+
import { readFile } from 'node:fs/promises'
4+
import path from 'node:path'
5+
import { fileURLToPath } from 'node:url'
56
import { watch } from 'chokidar'
67
import { globbySync } from 'globby'
78

89
const __dirname = path.resolve(fileURLToPath(import.meta.url), '..')
910
const dataJsonPath = path.resolve(__dirname, '../markdown/index.json')
1011
const workdirPath = path.resolve(__dirname, '../markdown/sections')
11-
const pathGlob = workdirPath + '/**/*.md'
12+
const pathGlob = `${workdirPath}/**/*.md`
1213

1314
const readFsDataJsonData = async () => {
1415
const hasFile = existsSync(dataJsonPath)
@@ -56,7 +57,7 @@ export async function bootstarp() {
5657
const fsJsonData = await readFsDataJsonData()
5758

5859
const diffData = compareFsTreeWithExistJsonData(parseFsData(fsJsonData))
59-
console.log('diff', diffData)
60+
6061
writeFileSync(
6162
dataJsonPath,
6263
JSON.stringify(patchDataJson(diffData, fsJsonData), null, 2),
@@ -108,10 +109,8 @@ function patchDataJson(diffData, fsJsonData) {
108109
if (!slugifyJsonMap[slug]) continue
109110

110111
paths.forEach((path) => {
111-
const index = slugifyJsonMap[slug].paths.findIndex(
112-
(_path) => path === _path,
113-
)
114-
if (index > -1) {
112+
const index = slugifyJsonMap[slug].paths.indexOf(path)
113+
if (index !== -1) {
115114
slugifyJsonMap[slug].paths.splice(index, 1)
116115
}
117116
})
@@ -225,7 +224,7 @@ function debounce(fn, wait) {
225224
let args = arguments
226225

227226
clearTimeout(timerId)
228-
timerId = setTimeout(function () {
227+
timerId = setTimeout(() => {
229228
callback.apply(context, args)
230229
}, wait)
231230
}

0 commit comments

Comments
 (0)